-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdsvex.config.js
43 lines (39 loc) · 1.12 KB
/
mdsvex.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
import { defineMDSveXConfig as defineConfig } from 'mdsvex';
import relativeImages from 'mdsvex-relative-images';
import autolinkHeadings from 'rehype-autolink-headings';
import slugPlugin from 'rehype-slug';
import remarkExternalLinks from 'remark-external-links';
import preview, { htmlFormatter, textFormatter } from 'remark-preview';
const config = defineConfig({
extensions: ['.svelte.md', '.md', '.svx'],
smartypants: {
dashes: 'oldschool',
},
remarkPlugins: [
// Add a text preview snippet (no formatting) so we can use it in the meta description tag
preview(textFormatter({ length: 250, maxBlocks: 2 })),
// Add an HTML preview snippet (formatted) so we can use it when displaying all posts
preview(
htmlFormatter({
length: 250,
maxBlocks: 2,
}),
{
attribute: 'previewHtml',
},
),
// external links open in a new tab
[remarkExternalLinks, { target: '_blank', rel: 'noopener' }],
relativeImages,
],
rehypePlugins: [
slugPlugin,
[
autolinkHeadings,
{
behavior: 'wrap',
},
],
],
});
export default config;