prosemirror-highlight 0.1.0 → 0.2.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/README.md +17 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -7
- package/dist/lowlight.js +0 -2
- package/dist/shiki.js +2 -2651
- package/dist/shikiji.d.ts +8 -0
- package/dist/shikiji.js +27 -0
- package/package.json +25 -4
- package/dist/chunk-YSQDPG26.js +0 -30
package/README.md
CHANGED
|
@@ -24,6 +24,22 @@ const parser = createParser(highlighter)
|
|
|
24
24
|
export const shikiPlugin = createHighlightPlugin({ parser })
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
### With [Shikiji]
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { getHighlighter } from 'shikiji'
|
|
31
|
+
|
|
32
|
+
import { createHighlightPlugin } from 'prosemirror-highlight'
|
|
33
|
+
import { createParser } from 'prosemirror-highlight/shikiji'
|
|
34
|
+
|
|
35
|
+
const highlighter = await getHighlighter({
|
|
36
|
+
themes: ['vitesse-light'],
|
|
37
|
+
langs: ['javascript', 'typescript', 'python'],
|
|
38
|
+
})
|
|
39
|
+
const parser = createParser(highlighter)
|
|
40
|
+
export const shikijiPlugin = createHighlightPlugin({ parser })
|
|
41
|
+
```
|
|
42
|
+
|
|
27
43
|
### With [lowlight] (based on [Highlight.js])
|
|
28
44
|
|
|
29
45
|
```ts
|
|
@@ -56,3 +72,4 @@ MIT
|
|
|
56
72
|
[lowlight]: https://github.com/wooorm/lowlight
|
|
57
73
|
[Highlight.js]: https://github.com/highlightjs/highlight.js
|
|
58
74
|
[Shiki]: https://github.com/shikijs/shiki
|
|
75
|
+
[Shikiji]: https://github.com/antfu/shikiji
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
1
2
|
import { Transaction, Plugin } from 'prosemirror-state';
|
|
2
3
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
3
|
-
import { Node } from 'prosemirror-model';
|
|
4
4
|
import { P as Parser, L as LanguageExtractor } from './types-wUmJTPF3.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -82,4 +82,4 @@ declare function createHighlightPlugin({ parser, nodeTypes, languageExtractor, }
|
|
|
82
82
|
languageExtractor?: LanguageExtractor;
|
|
83
83
|
}): Plugin<HighlightPluginState>;
|
|
84
84
|
|
|
85
|
-
export { DecorationCache, type HighlightPluginState, createHighlightPlugin };
|
|
85
|
+
export { DecorationCache, type HighlightPluginState, LanguageExtractor, Parser, createHighlightPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import "./chunk-YSQDPG26.js";
|
|
2
|
-
|
|
3
|
-
// src/plugin.ts
|
|
4
|
-
import "prosemirror-model";
|
|
5
|
-
import { Plugin, PluginKey } from "prosemirror-state";
|
|
6
|
-
import { DecorationSet } from "prosemirror-view";
|
|
7
|
-
|
|
8
1
|
// src/cache.ts
|
|
9
2
|
import "prosemirror-model";
|
|
10
3
|
import "prosemirror-state";
|
|
@@ -82,6 +75,9 @@ var DecorationCache = class _DecorationCache {
|
|
|
82
75
|
};
|
|
83
76
|
|
|
84
77
|
// src/plugin.ts
|
|
78
|
+
import "prosemirror-model";
|
|
79
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
80
|
+
import { DecorationSet } from "prosemirror-view";
|
|
85
81
|
function createHighlightPlugin({
|
|
86
82
|
parser,
|
|
87
83
|
nodeTypes = ["code_block"],
|