@shikijs/rehype 3.3.0 → 3.4.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/dist/index.d.mts +5 -0
- package/dist/index.mjs +3 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,11 @@ type RehypeShikiOptions = RehypeShikiCoreOptions & {
|
|
|
11
11
|
* @default Object.keys(bundledLanguages)
|
|
12
12
|
*/
|
|
13
13
|
langs?: Array<LanguageInput | BuiltinLanguage>;
|
|
14
|
+
/**
|
|
15
|
+
* Alias of languages
|
|
16
|
+
* @example { 'my-lang': 'javascript' }
|
|
17
|
+
*/
|
|
18
|
+
langAlias?: Record<string, string>;
|
|
14
19
|
};
|
|
15
20
|
declare const rehypeShiki: Plugin<[RehypeShikiOptions], Root>;
|
|
16
21
|
|
package/dist/index.mjs
CHANGED
|
@@ -7,12 +7,14 @@ import 'hast-util-to-string';
|
|
|
7
7
|
const rehypeShiki = function(options = {}) {
|
|
8
8
|
const themeNames = ("themes" in options ? Object.values(options.themes) : [options.theme]).filter(Boolean);
|
|
9
9
|
const langs = options.langs || Object.keys(bundledLanguages);
|
|
10
|
+
const langAlias = options.langAlias || {};
|
|
10
11
|
let getHandler;
|
|
11
12
|
return async (tree) => {
|
|
12
13
|
if (!getHandler) {
|
|
13
14
|
getHandler = getSingletonHighlighter({
|
|
14
15
|
themes: themeNames,
|
|
15
|
-
langs
|
|
16
|
+
langs,
|
|
17
|
+
langAlias
|
|
16
18
|
}).then((highlighter) => rehypeShikiFromHighlighter.call(this, highlighter, options));
|
|
17
19
|
}
|
|
18
20
|
const handler = await getHandler;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/rehype",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"description": "rehype integration for shiki",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"hast-util-to-string": "^3.0.1",
|
|
33
33
|
"unified": "^11.0.5",
|
|
34
34
|
"unist-util-visit": "^5.0.0",
|
|
35
|
-
"@shikijs/types": "3.
|
|
36
|
-
"shiki": "3.
|
|
35
|
+
"@shikijs/types": "3.4.1",
|
|
36
|
+
"shiki": "3.4.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"rehype-raw": "^7.0.0",
|
|
40
40
|
"rehype-stringify": "^10.0.1",
|
|
41
41
|
"remark-parse": "^11.0.0",
|
|
42
42
|
"remark-rehype": "^11.1.2",
|
|
43
|
-
"@shikijs/transformers": "3.
|
|
43
|
+
"@shikijs/transformers": "3.4.1"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "unbuild",
|