-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdsvex.config.js
114 lines (105 loc) · 3.24 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { defineMDSveXConfig as defineConfig } from 'mdsvex';
import a11yEmoji from '@fec/remark-a11y-emoji';
import { remarkDefinitionList, defListHastHandlers } from 'remark-definition-list';
import emoji from 'remark-emoji';
import remarkGithub from 'remark-github';
import remarkMath from 'remark-math';
// import oembed from '@agentofuser/remark-oembed';
import oembed from 'remark-oembed';
import remarkGfm from 'remark-gfm';
import remarkReferenceLinks from 'remark-reference-links';
import remarkInlineLinks from 'remark-inline-links';
import * as remarkMermaid from 'remark-mermaid';
import remarkTOC from 'remark-toc';
import preview, { htmlFormatter, textFormatter } from 'remark-preview';
import readingTime from 'remark-reading-time';
import readingMdxTime from "remark-reading-time/mdx.js";
import rehypeKatex from 'rehype-katex';
import remarkTypographer from './src/util/remarkTypographer.js';
import remarkEmbedder from '@remark-embedder/core';
import oembedTransformer from '@remark-embedder/transformer-oembed'
// XXX: NOT WORKING!
// import remarkHeadings from '@vcarl/remark-headings'; // adds to teh processing data. no way to get data out
// XXX: more plugins
import rehypeKatexSvelte from 'rehype-katex-svelte';
import rehypeTOC from 'rehype-toc';
import rehypeSlug from 'rehype-slug';
const oembedOptions = {
usePrefix: false,
// syncWidget: true,
providers: {
include: ['Twitter', 'Instagram'],
settings: {
// Ex. Show all Twitter embeds with the dark theme, and disables ad tracking
Twitter: {
theme: 'dark',
dnt: true
},
// Ex. Hide all Instagram comments by default, and
// add a facebook access token
Instagram: {
hidecaption: true,
// access_token: 'a-facebook-access-token'
}
}
}
}
const oembedTransformerConfig = {params: {theme: 'dark', dnt: true, omit_script: true}};
const config = defineConfig({
extensions: ['.svelte.md', '.md', '.svx', '.mdx'],
layout: {
post: './src/layouts/post.svelte',
posts: './src/layouts/posts.svelte',
portfolio: './src/layouts/portfolio.svelte',
_: './src/layouts/post.svelte'
},
smartypants: {
quotes: false,
dashes: 'oldschool'
},
remarkPlugins: [
remarkMath, // for latex support
[remarkEmbedder, {transformers: [[oembedTransformer,oembedTransformerConfig]]}],
remarkMermaid, // for diagrams
// // readingMdxTime,
remarkGfm,
// [oembed, oembedOptions],
remarkDefinitionList,
// [emoji, { emoticon: true }],
[remarkGithub, { repository: 'https://github.com/skamansam/skamansam.github.io/' }],
remarkTypographer,
remarkReferenceLinks,
remarkInlineLinks,
[remarkTOC, {
heading: 'toc|(table[ -]of[ -])?contents|on this page',
tight: true,
}],
a11yEmoji,
[readingTime, {key: 'readingTime'}],
preview(textFormatter({ length: 250, maxBlocks: 2 })),
preview(
htmlFormatter({
length: 250,
maxBlocks: 2,
}),
{
attribute: 'previewHtml',
}
),
preview(
textFormatter({
// length: 250,
// maxBlocks: 2,
}),
{
attribute: 'textContent',
},
),
],
rehypePlugins: [
rehypeKatexSvelte,
rehypeSlug,
defListHastHandlers
]
});
export default config;