forked from moiri-gamboni/pauseai-france
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvelte.config.js
53 lines (48 loc) · 1.47 KB
/
svelte.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import adapter from '@sveltejs/adapter-netlify'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import { mdsvex, escapeSvelte } from 'mdsvex'
import { getHighlighter } from 'shiki'
import remarkUnwrapImages from 'remark-unwrap-images'
import remarkToc from 'remark-toc'
import rehypeSlug from 'rehype-slug'
import { faqPlugin } from './src/lib/faqPlugin.js'
import { remarkFrenchTypography } from './src/lib/typographyPlugin.js'
import { config as dotenv } from 'dotenv'
dotenv()
/** @type {import('mdsvex').MdsvexOptions} */
const mdsvexOptions = {
extensions: ['.md'],
layout: {
_: './src/mdsvex.svelte'
},
highlight: {
highlighter: async (code, lang = 'text') => {
const highlighter = await getHighlighter({ theme: 'poimandres' })
const html = escapeSvelte(highlighter.codeToHtml(code, { lang }))
return `{@html \`${html}\` }`
}
},
remarkPlugins: [remarkUnwrapImages, [remarkToc, { tight: true }], remarkFrenchTypography],
rehypePlugins: [rehypeSlug, faqPlugin]
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte', '.md'],
preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)],
kit: {
adapter: adapter({
edge: true
}),
prerender: {
entries: process.env.PUBLIC_UNDER_CONSTRUCTION === 'true' ? [] : ['*']
},
alias: {
$assets: './src/assets',
$posts: './src/posts',
$components: './src/lib/components',
$config: './src/lib/config.ts',
$routes: './src/routes'
}
}
}
export default config