@vuepress/plugin-shiki 2.0.0-rc.0 → 2.0.0-rc.10
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/LICENSE +1 -1
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.js +1 -0
- package/lib/node/shikiPlugin.d.ts +31 -4
- package/lib/node/shikiPlugin.js +4 -3
- package/package.json +15 -11
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-present,
|
|
3
|
+
Copyright (c) 2018-present, VuePress Community
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/lib/node/index.d.ts
CHANGED
package/lib/node/index.js
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { BundledLanguage, BundledTheme, LanguageInput, SpecialLanguage, StringLiteralUnion, ThemeRegistration, ThemeRegistrationRaw } from 'shikiji';
|
|
2
|
+
import type { Plugin } from 'vuepress/core';
|
|
3
|
+
export type ShikiLang = LanguageInput | StringLiteralUnion<BundledLanguage> | SpecialLanguage;
|
|
4
|
+
export type ShikiTheme = ThemeRegistration | ThemeRegistrationRaw | StringLiteralUnion<BundledTheme>;
|
|
3
5
|
/**
|
|
4
6
|
* Options of @vuepress/plugin-shiki
|
|
5
7
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
+
export interface ShikiPluginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Languages to be loaded.
|
|
11
|
+
*
|
|
12
|
+
* Shikiji does not preload any languages to avoid extra overhead. So you need
|
|
13
|
+
* to specify the languages you want to use.
|
|
14
|
+
*
|
|
15
|
+
* @see https://shikiji.netlify.app/languages
|
|
16
|
+
*/
|
|
17
|
+
langs?: ShikiLang[];
|
|
18
|
+
/**
|
|
19
|
+
* The single theme to use
|
|
20
|
+
*
|
|
21
|
+
* @see https://shikiji.netlify.app/themes
|
|
22
|
+
*/
|
|
23
|
+
theme?: ShikiTheme;
|
|
24
|
+
/**
|
|
25
|
+
* The dark and light themes to use
|
|
26
|
+
*
|
|
27
|
+
* @see https://shikiji.netlify.app/themes
|
|
28
|
+
*/
|
|
29
|
+
themes?: {
|
|
30
|
+
dark: ShikiTheme;
|
|
31
|
+
light: ShikiTheme;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare const shikiPlugin: ({ langs, theme, themes, }?: ShikiPluginOptions) => Plugin;
|
package/lib/node/shikiPlugin.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { getHighlighter } from '
|
|
2
|
-
export const shikiPlugin = ({ theme = 'nord',
|
|
1
|
+
import { getHighlighter } from 'shikiji';
|
|
2
|
+
export const shikiPlugin = ({ langs, theme = 'nord', themes, } = {}) => ({
|
|
3
3
|
name: '@vuepress/plugin-shiki',
|
|
4
4
|
extendsMarkdown: async (md) => {
|
|
5
5
|
const highlighter = await getHighlighter({
|
|
6
|
-
theme,
|
|
7
6
|
langs,
|
|
7
|
+
themes: themes ? [themes.dark, themes.light] : [theme],
|
|
8
8
|
});
|
|
9
9
|
md.options.highlight = (code, lang) => highlighter.codeToHtml(code, {
|
|
10
10
|
lang,
|
|
11
|
+
...(themes ? { themes } : { theme }),
|
|
11
12
|
});
|
|
12
13
|
},
|
|
13
14
|
});
|
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.10",
|
|
4
4
|
"description": "VuePress plugin - shiki",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-plugin",
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
"shiki",
|
|
10
10
|
"highlight"
|
|
11
11
|
],
|
|
12
|
-
"homepage": "https://
|
|
12
|
+
"homepage": "https://ecosystem.vuejs.press/plugins/shiki.html",
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/vuepress/
|
|
14
|
+
"url": "https://github.com/vuepress/ecosystem/issues"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/vuepress/
|
|
18
|
+
"url": "git+https://github.com/vuepress/ecosystem.git",
|
|
19
|
+
"directory": "plugins/plugin-shiki"
|
|
19
20
|
},
|
|
20
21
|
"license": "MIT",
|
|
21
22
|
"author": "meteorlxy",
|
|
@@ -29,15 +30,18 @@
|
|
|
29
30
|
"files": [
|
|
30
31
|
"lib"
|
|
31
32
|
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -b tsconfig.build.json",
|
|
35
|
+
"clean": "rimraf --glob ./lib ./*.tsbuildinfo"
|
|
36
|
+
},
|
|
32
37
|
"dependencies": {
|
|
33
|
-
"
|
|
34
|
-
|
|
38
|
+
"shikiji": "^0.10.2"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"vuepress": "2.0.0-rc.5"
|
|
35
42
|
},
|
|
36
43
|
"publishConfig": {
|
|
37
44
|
"access": "public"
|
|
38
45
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"clean": "rimraf lib *.tsbuildinfo"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
46
|
+
"gitHead": "2e4d75617b030b584fb59346087790c982dbf411"
|
|
47
|
+
}
|