@vuepress/plugin-shiki 2.0.0-beta.50-pre → 2.0.0-beta.50-pre.1
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.
- package/lib/node/index.d.ts +3 -0
- package/lib/node/index.js +3 -0
- package/lib/node/shikiPlugin.d.ts +7 -0
- package/lib/node/shikiPlugin.js +13 -0
- package/package.json +3 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Plugin } from '@vuepress/core';
|
|
2
|
+
import type { HighlighterOptions } from 'shiki';
|
|
3
|
+
/**
|
|
4
|
+
* Options of @vuepress/plugin-shiki
|
|
5
|
+
*/
|
|
6
|
+
export declare type ShikiPluginOptions = Pick<HighlighterOptions, 'theme' | 'langs'>;
|
|
7
|
+
export declare const shikiPlugin: ({ theme, langs, }?: ShikiPluginOptions) => Plugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getHighlighter } from 'shiki';
|
|
2
|
+
export const shikiPlugin = ({ theme = 'nord', langs = [], } = {}) => ({
|
|
3
|
+
name: '@vuepress/plugin-shiki',
|
|
4
|
+
extendsMarkdown: async (md) => {
|
|
5
|
+
const highlighter = await getHighlighter({
|
|
6
|
+
theme,
|
|
7
|
+
langs,
|
|
8
|
+
});
|
|
9
|
+
md.options.highlight = (code, lang) => highlighter.codeToHtml(code, {
|
|
10
|
+
lang,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/plugin-shiki",
|
|
3
|
-
"version": "2.0.0-beta.50-pre",
|
|
3
|
+
"version": "2.0.0-beta.50-pre.1",
|
|
4
4
|
"description": "VuePress plugin - shiki",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-plugin",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"main": "./lib/node/index.js",
|
|
28
28
|
"types": "./lib/node/index.d.ts",
|
|
29
29
|
"files": [
|
|
30
|
-
"
|
|
30
|
+
"lib"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@vuepress/core": "2.0.0-beta.50-pre",
|
|
33
|
+
"@vuepress/core": "2.0.0-beta.50-pre.1",
|
|
34
34
|
"shiki": "^0.10.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|