forked from openbrewerydb/openbrewerydb-sveltekit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvelte.config.js
More file actions
67 lines (61 loc) · 1.5 KB
/
svelte.config.js
File metadata and controls
67 lines (61 loc) · 1.5 KB
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
59
60
61
62
63
64
65
66
67
import adapter from '@sveltejs/adapter-cloudflare';
import { mdsvex } from 'mdsvex';
import { sveltePreprocess } from 'svelte-preprocess';
import abbr from 'remark-abbr';
import urls from 'rehype-urls';
import slug from 'rehype-slug';
import autoLinkHeadings from 'rehype-autolink-headings';
import addClasses from 'rehype-add-classes';
function processUrl(url, node) {
if (node.tagName === 'a') {
node.properties.class = 'text-link';
if (!url.href.startsWith('/')) {
node.properties.target = '_blank';
node.properties.rel = 'noreferrer';
}
}
}
const config = {
compilerOptions: {},
extensions: ['.svelte', '.svx', '.md'],
kit: {
adapter: adapter({
fallback: 'plaintext',
routes: {
include: ['/*'],
exclude: ['<all>'],
},
}),
},
preprocess: [
mdsvex({
extensions: ['.svx', '.md'],
layout: {
page: './src/layouts/page.svelte',
news: './src/layouts/news.svelte',
},
remarkPlugins: [abbr],
rehypePlugins: [
[urls, processUrl],
slug,
[
autoLinkHeadings,
{
behavior: 'append',
properties: {
className: ['anchor-link'],
'aria-hidden': 'true',
},
content: {
type: 'text',
value: '#',
},
},
],
[addClasses, { ul: 'list-disc', ol: 'list-decimal' }],
],
}),
sveltePreprocess(),
],
};
export default config;