@shikijs/rehype 1.0.0-beta.6 → 1.0.0
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/core.d.mts +0 -7
- package/dist/core.d.ts +0 -7
- package/dist/core.mjs +0 -10
- package/dist/index.mjs +0 -1
- package/package.json +3 -3
package/dist/core.d.mts
CHANGED
|
@@ -8,13 +8,6 @@ interface MapLike<K = any, V = any> {
|
|
|
8
8
|
set: (key: K, value: V) => this;
|
|
9
9
|
}
|
|
10
10
|
interface RehypeShikiExtraOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Add `highlighted` class to lines defined in after codeblock
|
|
13
|
-
*
|
|
14
|
-
* @deprecated Use [transformerNotationHighlight](https://shiki.style/packages/transformers#transformernotationhighlight) instead
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
highlightLines?: boolean | string;
|
|
18
11
|
/**
|
|
19
12
|
* Add `language-*` class to code element
|
|
20
13
|
*
|
package/dist/core.d.ts
CHANGED
|
@@ -8,13 +8,6 @@ interface MapLike<K = any, V = any> {
|
|
|
8
8
|
set: (key: K, value: V) => this;
|
|
9
9
|
}
|
|
10
10
|
interface RehypeShikiExtraOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Add `highlighted` class to lines defined in after codeblock
|
|
13
|
-
*
|
|
14
|
-
* @deprecated Use [transformerNotationHighlight](https://shiki.style/packages/transformers#transformernotationhighlight) instead
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
highlightLines?: boolean | string;
|
|
18
11
|
/**
|
|
19
12
|
* Add `language-*` class to code element
|
|
20
13
|
*
|
package/dist/core.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { toString } from 'hast-util-to-string';
|
|
2
2
|
import { visit } from 'unist-util-visit';
|
|
3
|
-
import { transformerMetaHighlight } from '@shikijs/transformers';
|
|
4
3
|
|
|
5
4
|
const rehypeShikiFromHighlighter = function(highlighter, options) {
|
|
6
5
|
const {
|
|
7
|
-
highlightLines = false,
|
|
8
6
|
addLanguageClass = false,
|
|
9
7
|
parseMetaString,
|
|
10
8
|
cache,
|
|
@@ -53,14 +51,6 @@ const rehypeShikiFromHighlighter = function(highlighter, options) {
|
|
|
53
51
|
}
|
|
54
52
|
});
|
|
55
53
|
}
|
|
56
|
-
if (highlightLines && typeof metaString === "string") {
|
|
57
|
-
codeOptions.transformers || (codeOptions.transformers = []);
|
|
58
|
-
codeOptions.transformers.push(
|
|
59
|
-
transformerMetaHighlight({
|
|
60
|
-
className: highlightLines === true ? "highlighted" : highlightLines
|
|
61
|
-
})
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
54
|
try {
|
|
65
55
|
const fragment = highlighter.codeToHast(code, codeOptions);
|
|
66
56
|
cache?.set(code, fragment.children);
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { bundledLanguages, getHighlighter } from 'shiki';
|
|
|
2
2
|
import rehypeShikiFromHighlighter from './core.mjs';
|
|
3
3
|
import 'hast-util-to-string';
|
|
4
4
|
import 'unist-util-visit';
|
|
5
|
-
import '@shikijs/transformers';
|
|
6
5
|
|
|
7
6
|
const rehypeShiki = function(options = {}) {
|
|
8
7
|
const themeNames = ("themes" in options ? Object.values(options.themes) : [options.theme]).filter(Boolean);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/rehype",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"description": "rehype integration for shiki",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"hast-util-to-string": "^3.0.0",
|
|
50
50
|
"unified": "^11.0.4",
|
|
51
51
|
"unist-util-visit": "^5.0.0",
|
|
52
|
-
"@shikijs/transformers": "1.0.0
|
|
53
|
-
"shiki": "1.0.0
|
|
52
|
+
"@shikijs/transformers": "1.0.0",
|
|
53
|
+
"shiki": "1.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"rehype-raw": "^7.0.0",
|