@vuepress/plugin-shiki 2.0.0-beta.5 → 2.0.0-beta.50
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/{index.d.ts → node/shikiPlugin.d.ts} +1 -2
- package/lib/node/shikiPlugin.js +13 -0
- package/package.json +15 -11
- package/CHANGELOG.md +0 -11
- package/lib/index.js +0 -16
|
@@ -4,5 +4,4 @@ import type { HighlighterOptions } from 'shiki';
|
|
|
4
4
|
* Options of @vuepress/plugin-shiki
|
|
5
5
|
*/
|
|
6
6
|
export declare type ShikiPluginOptions = Pick<HighlighterOptions, 'theme' | 'langs'>;
|
|
7
|
-
export declare const shikiPlugin: Plugin
|
|
8
|
-
export default shikiPlugin;
|
|
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.
|
|
3
|
+
"version": "2.0.0-beta.50",
|
|
4
4
|
"description": "VuePress plugin - shiki",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-plugin",
|
|
@@ -19,21 +19,25 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"author": "meteorlxy",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./lib/node/index.js",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"main": "./lib/node/index.js",
|
|
28
|
+
"types": "./lib/node/index.d.ts",
|
|
24
29
|
"files": [
|
|
25
30
|
"lib"
|
|
26
31
|
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsc -b tsconfig.build.json",
|
|
29
|
-
"clean": "rimraf lib *.tsbuildinfo"
|
|
30
|
-
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@vuepress/core": "2.0.0-beta.
|
|
33
|
-
"shiki": "^0.
|
|
33
|
+
"@vuepress/core": "2.0.0-beta.50",
|
|
34
|
+
"shiki": "^0.10.1"
|
|
34
35
|
},
|
|
35
36
|
"publishConfig": {
|
|
36
37
|
"access": "public"
|
|
37
38
|
},
|
|
38
|
-
"
|
|
39
|
-
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -b tsconfig.build.json",
|
|
41
|
+
"clean": "rimraf lib *.tsbuildinfo"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [2.0.0-beta.5](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.4...v2.0.0-beta.5) (2021-03-26)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* **plugin-shiki:** add shiki plugin ([66bbcbd](https://github.com/vuepress/vuepress-next/commit/66bbcbde497cca525fc585b4046b11784e8d61bc))
|
package/lib/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shikiPlugin = void 0;
|
|
4
|
-
const shiki_1 = require("shiki");
|
|
5
|
-
const shikiPlugin = ({ theme = 'nord', langs = [], }) => ({
|
|
6
|
-
name: '@vuepress/plugin-shiki',
|
|
7
|
-
async extendsMarkdown(md) {
|
|
8
|
-
const highlighter = await shiki_1.getHighlighter({
|
|
9
|
-
theme,
|
|
10
|
-
langs,
|
|
11
|
-
});
|
|
12
|
-
md.options.highlight = (code, lang) => highlighter.codeToHtml(code, lang);
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
exports.shikiPlugin = shikiPlugin;
|
|
16
|
-
exports.default = exports.shikiPlugin;
|