@shikijs/rehype 2.4.2 → 3.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/rehype",
3
3
  "type": "module",
4
- "version": "2.4.2",
4
+ "version": "3.0.0",
5
5
  "description": "rehype integration for shiki",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -18,29 +18,12 @@
18
18
  ],
19
19
  "sideEffects": false,
20
20
  "exports": {
21
- ".": {
22
- "types": "./dist/index.d.mts",
23
- "default": "./dist/index.mjs"
24
- },
25
- "./core": {
26
- "types": "./dist/core.d.mts",
27
- "default": "./dist/core.mjs"
28
- }
21
+ ".": "./dist/index.mjs",
22
+ "./core": "./dist/core.mjs"
29
23
  },
30
24
  "main": "./dist/index.mjs",
31
25
  "module": "./dist/index.mjs",
32
26
  "types": "./dist/index.d.mts",
33
- "typesVersions": {
34
- "*": {
35
- "core": [
36
- "./dist/core.d.mts"
37
- ],
38
- "*": [
39
- "./dist/*",
40
- "./*"
41
- ]
42
- }
43
- },
44
27
  "files": [
45
28
  "dist"
46
29
  ],
@@ -49,15 +32,15 @@
49
32
  "hast-util-to-string": "^3.0.1",
50
33
  "unified": "^11.0.5",
51
34
  "unist-util-visit": "^5.0.0",
52
- "@shikijs/types": "2.4.2",
53
- "shiki": "2.4.2"
35
+ "@shikijs/types": "3.0.0",
36
+ "shiki": "3.0.0"
54
37
  },
55
38
  "devDependencies": {
56
39
  "rehype-raw": "^7.0.0",
57
40
  "rehype-stringify": "^10.0.1",
58
41
  "remark-parse": "^11.0.0",
59
42
  "remark-rehype": "^11.1.1",
60
- "@shikijs/transformers": "2.4.2"
43
+ "@shikijs/transformers": "3.0.0"
61
44
  },
62
45
  "scripts": {
63
46
  "build": "unbuild",
package/dist/core.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { HighlighterGeneric } from '@shikijs/types';
2
- import { Root } from 'hast';
3
- import { Transformer } from 'unified';
4
- import { R as RehypeShikiCoreOptions } from './shared/rehype.DcMmi29I.js';
5
- export { M as MapLike, a as RehypeShikiExtraOptions } from './shared/rehype.DcMmi29I.js';
6
- import 'shiki';
7
-
8
- declare function rehypeShikiFromHighlighter(highlighter: HighlighterGeneric<any, any>, options: RehypeShikiCoreOptions): Transformer<Root, Root>;
9
-
10
- export { RehypeShikiCoreOptions, rehypeShikiFromHighlighter as default };
package/dist/index.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { LanguageInput } from '@shikijs/types';
2
- import { Root } from 'hast';
3
- import { BuiltinLanguage } from 'shiki';
4
- import { Plugin } from 'unified';
5
- import { R as RehypeShikiCoreOptions } from './shared/rehype.DcMmi29I.js';
6
-
7
- type RehypeShikiOptions = RehypeShikiCoreOptions & {
8
- /**
9
- * Language names to include.
10
- *
11
- * @default Object.keys(bundledLanguages)
12
- */
13
- langs?: Array<LanguageInput | BuiltinLanguage>;
14
- };
15
- declare const rehypeShiki: Plugin<[RehypeShikiOptions], Root>;
16
-
17
- export { type RehypeShikiOptions, rehypeShiki as default };
@@ -1,68 +0,0 @@
1
- import { Element, Root } from 'hast';
2
- import { CodeOptionsThemes, BuiltinTheme, TransformerOptions, CodeOptionsMeta, CodeToHastOptionsCommon } from 'shiki';
3
-
4
- interface MapLike<K = any, V = any> {
5
- get: (key: K) => V | undefined;
6
- set: (key: K, value: V) => this;
7
- }
8
- interface RehypeShikiExtraOptions {
9
- /**
10
- * Add `language-*` class to code element
11
- *
12
- * @default false
13
- */
14
- addLanguageClass?: boolean;
15
- /**
16
- * The default language to use when is not specified
17
- */
18
- defaultLanguage?: string;
19
- /**
20
- * The fallback language to use when specified language is not loaded, or not included in the bundle
21
- */
22
- fallbackLanguage?: string;
23
- /**
24
- * Load languages and themes on-demand.
25
- * When enable, this would make requires the unified pipeline to be async.
26
- *
27
- * @default false
28
- */
29
- lazy?: boolean;
30
- /**
31
- * `mdast-util-to-hast` adds a newline to the end of code blocks
32
- *
33
- * This option strips that newline from the code block
34
- *
35
- * @default true
36
- * @see https://github.com/syntax-tree/mdast-util-to-hast/blob/f511a93817b131fb73419bf7d24d73a5b8b0f0c2/lib/handlers/code.js#L22
37
- */
38
- stripEndNewline?: boolean;
39
- /**
40
- * Custom meta string parser
41
- * Return an object to merge with `meta`
42
- */
43
- parseMetaString?: (metaString: string, node: Element, tree: Root) => Record<string, any> | undefined | null;
44
- /**
45
- * Highlight inline code blocks
46
- *
47
- * - `false`: disable inline code block highlighting
48
- * - `tailing-curly-colon`: highlight with `\`code{:lang}\``
49
- *
50
- * @see https://shiki.style/packages/rehype#inline-code
51
- * @default false
52
- */
53
- inline?: false | 'tailing-curly-colon';
54
- /**
55
- * Custom map to cache transformed codeToHast result
56
- *
57
- * @default undefined
58
- */
59
- cache?: MapLike<string, Root>;
60
- /**
61
- * Chance to handle the error
62
- * If not provided, the error will be thrown
63
- */
64
- onError?: (error: unknown) => void;
65
- }
66
- type RehypeShikiCoreOptions = CodeOptionsThemes<BuiltinTheme> & TransformerOptions & CodeOptionsMeta & RehypeShikiExtraOptions & Omit<CodeToHastOptionsCommon, 'lang'>;
67
-
68
- export type { MapLike as M, RehypeShikiCoreOptions as R, RehypeShikiExtraOptions as a };