@vuepress/plugin-shiki 2.0.0-rc.38 → 2.0.0-rc.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--code-c-text: #9e9e9e;
|
|
3
|
+
--code-c-highlight-bg: rgb(0 0 0 / 66%);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.shiki span {
|
|
7
|
+
color: var(--shiki-light, inherit);
|
|
8
|
+
}
|
|
9
|
+
[data-theme=dark] .shiki span {
|
|
10
|
+
color: var(--shiki-dark, inherit);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
div[data-highlighter=shiki] {
|
|
14
|
+
background-color: var(--code-c-bg, --shiki-light-bg);
|
|
15
|
+
}
|
|
16
|
+
[data-theme=dark] div[data-highlighter=shiki] {
|
|
17
|
+
background-color: var(--code-c-bg, --shiki-dark-bg);
|
|
18
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { App } from 'vuepress';
|
|
2
|
+
import type { ShikiPluginOptions } from './options.js';
|
|
3
|
+
export declare const prepareConfigFile: (app: App, { lineNumbers, notationDiff, notationErrorLevel, notationFocus, notationHighlight, notationWordHighlight, whitespace, }: ShikiPluginOptions) => Promise<string>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getRealPath } from '@vuepress/helper';
|
|
2
|
+
import { PLUGIN_NAME } from './utils.js';
|
|
3
|
+
const { url } = import.meta;
|
|
4
|
+
export const prepareConfigFile = (app, { lineNumbers = true, notationDiff, notationErrorLevel, notationFocus, notationHighlight, notationWordHighlight, whitespace, }) => {
|
|
5
|
+
const imports = [
|
|
6
|
+
`import "${getRealPath('@vuepress/highlighter-helper/styles/base.css', url)}"`,
|
|
7
|
+
`import "${getRealPath(`${PLUGIN_NAME}/styles/shiki.css`, import.meta.url)}"`,
|
|
8
|
+
];
|
|
9
|
+
if (lineNumbers) {
|
|
10
|
+
imports.push(`import "${getRealPath('@vuepress/highlighter-helper/styles/line-numbers.css', url)}"`);
|
|
11
|
+
}
|
|
12
|
+
if (notationDiff) {
|
|
13
|
+
imports.push(`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-diff.css', url)}"`);
|
|
14
|
+
}
|
|
15
|
+
if (notationErrorLevel) {
|
|
16
|
+
imports.push(`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-error-level.css', url)}"`);
|
|
17
|
+
}
|
|
18
|
+
if (notationFocus) {
|
|
19
|
+
imports.push(`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-focus.css', url)}"`);
|
|
20
|
+
}
|
|
21
|
+
if (notationHighlight) {
|
|
22
|
+
imports.push(`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-highlight.css', url)}"`);
|
|
23
|
+
}
|
|
24
|
+
if (notationWordHighlight) {
|
|
25
|
+
imports.push(`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-word-highlight.css', url)}"`);
|
|
26
|
+
}
|
|
27
|
+
if (whitespace) {
|
|
28
|
+
imports.push(`import "${getRealPath('@vuepress/highlighter-helper/styles/whitespace.css', url)}"`);
|
|
29
|
+
}
|
|
30
|
+
return app.writeTemp('shiki/config.js', imports.join('\n'));
|
|
31
|
+
};
|
package/lib/node/shikiPlugin.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { lineNumbers as lineNumbersPlugin } from '@vuepress/highlighter-helper';
|
|
2
2
|
import { isPlainObject } from 'vuepress/shared';
|
|
3
3
|
import { applyHighlighter, highlightLinesPlugin, preWrapperPlugin, } from './markdown/index.js';
|
|
4
|
+
import { prepareConfigFile } from './prepareConfigFile.js';
|
|
4
5
|
export const shikiPlugin = ({ preWrapper = true, lineNumbers = true, ...options } = {}) => ({
|
|
5
6
|
name: '@vuepress/plugin-shiki',
|
|
6
7
|
extendsMarkdown: async (md, app) => {
|
|
8
|
+
// FIXME: Remove in stable version
|
|
7
9
|
const { code } = app.options.markdown;
|
|
8
10
|
await applyHighlighter(md, app, {
|
|
9
11
|
...(isPlainObject(code) ? code : {}),
|
|
@@ -15,4 +17,5 @@ export const shikiPlugin = ({ preWrapper = true, lineNumbers = true, ...options
|
|
|
15
17
|
md.use(lineNumbersPlugin, { lineNumbers });
|
|
16
18
|
}
|
|
17
19
|
},
|
|
20
|
+
clientConfigFile: (app) => prepareConfigFile(app, options),
|
|
18
21
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/plugin-shiki",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.40",
|
|
4
4
|
"description": "VuePress plugin - shiki",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-plugin",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": "./lib/node/index.js",
|
|
26
|
+
"./styles/*": "./lib/client/styles/*",
|
|
26
27
|
"./package.json": "./package.json"
|
|
27
28
|
},
|
|
28
29
|
"main": "./lib/node/index.js",
|
|
@@ -31,11 +32,11 @@
|
|
|
31
32
|
"lib"
|
|
32
33
|
],
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@shikijs/transformers": "^1.
|
|
35
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
36
|
-
"@vuepress/highlighter-helper": "2.0.0-rc.
|
|
35
|
+
"@shikijs/transformers": "^1.11.1",
|
|
36
|
+
"@vuepress/helper": "2.0.0-rc.40",
|
|
37
|
+
"@vuepress/highlighter-helper": "2.0.0-rc.40",
|
|
37
38
|
"nanoid": "^5.0.7",
|
|
38
|
-
"shiki": "^1.
|
|
39
|
+
"shiki": "^1.11.1"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"vuepress": "2.0.0-rc.14"
|
|
@@ -43,5 +44,5 @@
|
|
|
43
44
|
"publishConfig": {
|
|
44
45
|
"access": "public"
|
|
45
46
|
},
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "942849e4983555f1a7cf03a96579110a505492cb"
|
|
47
48
|
}
|