diff --git a/src/icons/optimized/external-icon.svg b/src/icons/optimized/external-icon.svg new file mode 100644 index 0000000000..55cb1abdae --- /dev/null +++ b/src/icons/optimized/external-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/external-icon.svg b/src/icons/svg/external-icon.svg new file mode 100644 index 0000000000..59321a9820 --- /dev/null +++ b/src/icons/svg/external-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lib/components/blog/copy-as-markdown.svelte b/src/lib/components/blog/copy-as-markdown.svelte index 54e111f36c..1533cf21fe 100644 --- a/src/lib/components/blog/copy-as-markdown.svelte +++ b/src/lib/components/blog/copy-as-markdown.svelte @@ -1,45 +1,178 @@ -{#if $rawContent} - + {#snippet tooltip()} + Copied + {/snippet} + + + + + {#if $open} + {/if} - + {/if} + + diff --git a/src/lib/components/blog/table-of-contents.svelte b/src/lib/components/blog/table-of-contents.svelte index c06bc12ee0..ae091cf713 100644 --- a/src/lib/components/blog/table-of-contents.svelte +++ b/src/lib/components/blog/table-of-contents.svelte @@ -81,5 +81,4 @@ style:transform={`translateY(${position}px)`} > - diff --git a/src/lib/components/ui/icon/sprite/sprite.svelte b/src/lib/components/ui/icon/sprite/sprite.svelte index efc46b18bb..033b45cdd4 100644 --- a/src/lib/components/ui/icon/sprite/sprite.svelte +++ b/src/lib/components/ui/icon/sprite/sprite.svelte @@ -3,20 +3,18 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="display: none;" > - - + + + + + - + @@ -27,222 +25,222 @@ fill="currentColor" > - + - + - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + - + - + - + - + - + - + - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + + + + - + - + - + - + - + + + + - + - + - + - + - + - + - + ; @@ -40,7 +41,7 @@
diff --git a/src/lib/remote/markdown.remote.ts b/src/lib/remote/markdown.remote.ts new file mode 100644 index 0000000000..e7a4071e12 --- /dev/null +++ b/src/lib/remote/markdown.remote.ts @@ -0,0 +1,15 @@ +import { query } from '$app/server'; +import { readFile } from 'fs/promises'; +import { join } from 'path'; + +const getMarkdownContent = async (routeId: string | null) => { + if (!routeId) return null; + try { + const basePath = join(process.cwd(), 'src', 'routes', routeId, '+page.markdoc'); + return await readFile(basePath, 'utf-8'); + } catch (e) { + return null; + } +}; + +export const getPageMarkdown = query('unchecked', getMarkdownContent); diff --git a/src/lib/utils/get-markdown-content.ts b/src/lib/utils/get-markdown-content.ts deleted file mode 100644 index e2860fb5d9..0000000000 --- a/src/lib/utils/get-markdown-content.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { readFile } from 'fs/promises'; -import { join } from 'path'; - -export const getMarkdownContent = async (slug: T) => { - if (!slug) return null; - try { - const basePath = join(process.cwd(), 'src', 'routes', slug, '+page.markdoc'); - return await readFile(basePath, 'utf-8'); - } catch (e) { - return null; - } -}; diff --git a/src/routes/blog/+layout.server.ts b/src/routes/blog/+layout.server.ts index 22833f0960..fa5296da9f 100644 --- a/src/routes/blog/+layout.server.ts +++ b/src/routes/blog/+layout.server.ts @@ -1,8 +1,8 @@ -import { getMarkdownContent } from '$lib/utils/get-markdown-content'; +import { getPageMarkdown } from '$lib/remote/markdown.remote'; import type { LayoutRouteId } from './$types'; export const load = async ({ route }) => { return { - rawContent: await getMarkdownContent(route.id) + rawContent: await getPageMarkdown(route.id as LayoutRouteId) }; }; diff --git a/src/routes/docs/+layout.server.ts b/src/routes/docs/+layout.server.ts index 22833f0960..fa5296da9f 100644 --- a/src/routes/docs/+layout.server.ts +++ b/src/routes/docs/+layout.server.ts @@ -1,8 +1,8 @@ -import { getMarkdownContent } from '$lib/utils/get-markdown-content'; +import { getPageMarkdown } from '$lib/remote/markdown.remote'; import type { LayoutRouteId } from './$types'; export const load = async ({ route }) => { return { - rawContent: await getMarkdownContent(route.id) + rawContent: await getPageMarkdown(route.id as LayoutRouteId) }; }; diff --git a/svelte.config.js b/svelte.config.js index d0a2a988fa..5170f11599 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -64,7 +64,9 @@ const config = { instrumentation: { server: true - } + }, + + remoteFunctions: true } } };