diff --git a/src/app.html b/src/app.html index 59ec69c4f0..36b4ad69ca 100644 --- a/src/app.html +++ b/src/app.html @@ -15,14 +15,16 @@ const isDocs = window.location.pathname.startsWith('/docs'); if (isDocs) { const theme = localStorage.getItem('theme'); - document.body.classList.remove('theme-dark', 'theme-light'); - if (theme === 'system') { - const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches - ? 'dark' - : 'light'; - document.body.classList.add(`theme-${systemTheme}`); - } else { - document.body.classList.add(`theme-${theme}`); + if (theme) { + document.body.classList.remove('theme-dark', 'theme-light'); + if (theme === 'system') { + const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches + ? 'dark' + : 'light'; + document.body.classList.add(`theme-${systemTheme}`); + } else { + document.body.classList.add(`theme-${theme}`); + } } } diff --git a/src/lib/utils/markdown.ts b/src/lib/utils/markdown.ts index 79c313c6a5..93f4d939bc 100644 --- a/src/lib/utils/markdown.ts +++ b/src/lib/utils/markdown.ts @@ -19,6 +19,9 @@ function transform_tokens(tokens: ReturnType): ReturnType { + const target = `/src/routes/docs/references/[version]/[platform]/[service]/descriptions/${service}.md`; + + if (!(target in descriptions)) { + throw new Error('Missing service description'); + } + return descriptions[target](); +} + export async function getService( version: string, platform: string, @@ -186,7 +202,7 @@ export async function getService( const data: Awaited> = { service: { name: tag?.name as Service, - description: tag?.description ?? '' + description: await getDescription(service) }, methods: [] }; diff --git a/src/routes/docs/references/[version]/[platform]/[service]/+page.svelte b/src/routes/docs/references/[version]/[platform]/[service]/+page.svelte index 4c2089cde5..be6aa8c314 100644 --- a/src/routes/docs/references/[version]/[platform]/[service]/+page.svelte +++ b/src/routes/docs/references/[version]/[platform]/[service]/+page.svelte @@ -133,14 +133,23 @@
-

- {data.service?.description} -

+ {@html parse(data.service?.description)}
+ {#if data.methods.length === 0} +
+
+
+
+ {/if}
{#each data.methods as method (method.id)}
-
+
{method.title}
@@ -254,7 +263,9 @@