2026-03-13 11:21:05 +01:00
|
|
|
import { escapeSvelte, mdsvex } from 'mdsvex';
|
2023-11-25 21:56:02 +00:00
|
|
|
|
2026-03-13 18:40:07 +01:00
|
|
|
import adapter from '@sveltejs/adapter-cloudflare';
|
2026-03-13 11:21:05 +01:00
|
|
|
import { dirname } from 'node:path';
|
|
|
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
import rehypeSlug from 'rehype-slug';
|
|
|
|
|
import remarkToc from 'remark-toc';
|
|
|
|
|
import remarkUnwrapImages from 'remark-unwrap-images';
|
|
|
|
|
import shiki from 'shiki';
|
|
|
|
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
|
|
|
|
2023-11-25 21:56:02 +00:00
|
|
|
/** @type {import('@sveltejs/kit').Config}*/
|
2024-02-02 08:18:26 +01:00
|
|
|
|
|
|
|
|
/** @type {import('mdsvex').MdsvexOptions} */
|
|
|
|
|
const mdsvexOptions = {
|
|
|
|
|
extensions: ['.md'],
|
|
|
|
|
layout: {
|
2024-03-09 06:25:06 +01:00
|
|
|
_: dirname(fileURLToPath(import.meta.url)) + '/src/mdsvex.svelte'
|
2024-02-02 08:18:26 +01:00
|
|
|
},
|
|
|
|
|
highlight: {
|
|
|
|
|
highlighter: async (code, lang = 'text') => {
|
|
|
|
|
const highlighter = await shiki.getHighlighter({ theme: 'poimandres' });
|
|
|
|
|
const html = escapeSvelte(highlighter.codeToHtml(code, { lang }));
|
|
|
|
|
return `{@html \`${html}\` }`;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
remarkPlugins: [remarkUnwrapImages, [remarkToc, { tight: true }]],
|
|
|
|
|
rehypePlugins: [rehypeSlug]
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-25 21:56:02 +00:00
|
|
|
const config = {
|
2024-02-02 08:18:26 +01:00
|
|
|
kit: {
|
2026-03-13 18:40:07 +01:00
|
|
|
adapter: adapter(),
|
2025-12-20 12:44:59 +01:00
|
|
|
alias: {
|
|
|
|
|
$lib: path.resolve('./src/lib'),
|
|
|
|
|
'$src/tools': path.resolve('./node_modules/@cio/ui/src/tools/index.ts'),
|
|
|
|
|
'$src/base/*': path.resolve('./node_modules/@cio/ui/src/base/*'),
|
|
|
|
|
'@cio/ui': path.resolve('./node_modules/@cio/ui/src'),
|
|
|
|
|
'@cio/ui/*': path.resolve('./node_modules/@cio/ui/src/*'),
|
|
|
|
|
'@cio/utils': path.resolve('./node_modules/@cio/utils/dist'),
|
|
|
|
|
'@cio/utils/*': path.resolve('./node_modules/@cio/utils/dist/*')
|
|
|
|
|
}
|
2024-02-02 08:18:26 +01:00
|
|
|
},
|
|
|
|
|
extensions: ['.svelte', '.md'],
|
2025-12-20 12:44:59 +01:00
|
|
|
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)]
|
2023-11-25 21:56:02 +00:00
|
|
|
};
|
|
|
|
|
export default config;
|