Skip to content

Commit e46a291

Browse files
committed
Switch to Shiki Rehype plugin
1 parent ae14172 commit e46a291

File tree

4 files changed

+188
-200
lines changed

4 files changed

+188
-200
lines changed

‎docusaurus.config.js‎

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// Note: type annotations allow type checking and IDEs autocompletion
33

44
constfs=require('node:fs');
5-
constremarkShikiTwoSlash=require('remark-shiki-twoslash').default;
6-
constrehypeRaw=require('rehype-raw').default;
5+
constrehypeShiki=require('@shikijs/rehype').default;
76

87
constrehypeRawOptions={
98
passThrough: ['mdxjsEsm','mdxJsxTextElement','mdxJsxFlowElement','mdxFlowExpression']
@@ -41,33 +40,26 @@ const config ={
4140
docs: {
4241
breadcrumbs: false,
4342
sidebarPath: require.resolve('./sidebars.js'),
44-
rehypePlugins: [[rehypeRaw,rehypeRawOptions]],// fix for MDX compilation courtesy of kamranayub: https://github.com/shikijs/twoslash/issues/125#issuecomment-2692325341
43+
beforeDefaultRehypePlugins: [
44+
[
45+
rehypeShiki,
46+
{
47+
theme: require('./src/theme/monokai-patched.json'),
48+
langs: [
49+
'c',
50+
'cpp',
51+
'lua',
52+
require('./src/theme/Pluto.tmLanguage.json'),
53+
],
54+
}
55+
],
56+
],
4557
},
4658
theme: {
4759
customCss: require.resolve('./src/css/custom.css'),
4860
},
4961
}),
5062
],
51-
[
52-
'docusaurus-preset-shiki-twoslash',
53-
{
54-
theme: 'monokai-patched',
55-
langs: [
56-
'c',
57-
'cpp',
58-
'lua',
59-
{
60-
id: 'pluto',
61-
name: 'pluto',
62-
scopeName: 'source.pluto',
63-
path: require.resolve('./src/theme/Pluto.tmLanguage.json'),
64-
}
65-
],
66-
themes: [
67-
require('./src/theme/monokai-patched.json'),
68-
],
69-
}
70-
],
7163
],
7264

7365
themeConfig:

0 commit comments

Comments
(0)