-
Notifications
You must be signed in to change notification settings - Fork 6
/
svelte.config.js
58 lines (51 loc) · 1.33 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
54
55
56
57
58
import adapter from '@sveltejs/adapter-static'
import { s } from 'hastscript'
import { mdsvex } from 'mdsvex'
import mdsvexamples from 'mdsvexamples'
import link_headings from 'rehype-autolink-headings'
import heading_slugs from 'rehype-slug'
import preprocess from 'svelte-preprocess'
const rehypePlugins = [
heading_slugs,
[
link_headings,
{
behavior: `append`,
test: [`h2`, `h3`, `h4`, `h5`, `h6`], // don't auto-link <h1>
content: s(
`svg`,
{ width: 16, height: 16, viewBox: `0 0 16 16` },
// symbol #octicon-link defined in app.html
s(`use`, { 'xlink:href': `#octicon-link` }),
),
},
],
]
const { default: pkg } = await import(`./package.json`, {
assert: { type: `json` },
})
const defaults = {
Wrapper: `svelte-zoo/CodeExample.svelte`,
pkg: pkg.name,
repo: pkg.repository,
}
const remarkPlugins = [[mdsvexamples, { defaults }]]
/** @type {import('@sveltejs/kit').Config} */
export default {
extensions: [`.svelte`, `.svx`, `.md`],
preprocess: [
preprocess(),
mdsvex({ rehypePlugins, remarkPlugins, extensions: [`.svx`, `.md`] }),
],
kit: {
adapter: adapter(),
alias: {
$root: `.`,
$site: `src/site`,
},
},
compilerOptions: {
// enable direct prop access for vitest unit tests
accessors: process.env.TEST,
},
}