prosemirror-highlight 0.12.0 → 0.12.2
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 +4 -4
- package/dist/shiki.js +1 -1
- package/dist/sugar-high.js +2 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -82,15 +82,15 @@ export const shikiLazyPlugin = createHighlightPlugin({ parser: lazyParser })
|
|
|
82
82
|
|
|
83
83
|
When using Shiki, two CSS variables are set automatically to the `<pre>` element:
|
|
84
84
|
|
|
85
|
-
- `--
|
|
86
|
-
- `--
|
|
85
|
+
- `--prosemirror-highlight`: The text color of the code block
|
|
86
|
+
- `--prosemirror-highlight-bg`: The background color of the code block
|
|
87
87
|
|
|
88
88
|
You can use these variables to set the background color and text color of the code block.
|
|
89
89
|
|
|
90
90
|
```css
|
|
91
91
|
.ProseMirror pre {
|
|
92
|
-
color: var(--
|
|
93
|
-
background-color: var(--
|
|
92
|
+
color: var(--prosemirror-highlight, inherit);
|
|
93
|
+
background-color: var(--prosemirror-highlight-bg, inherit);
|
|
94
94
|
}
|
|
95
95
|
```
|
|
96
96
|
|
package/dist/shiki.js
CHANGED
|
@@ -12,7 +12,7 @@ function createParser(highlighter, options) {
|
|
|
12
12
|
theme: highlighter.getLoadedThemes()[0]
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
const style = rootStyle || (fg && bg ? `--
|
|
15
|
+
const style = rootStyle || (fg && bg ? `--prosemirror-highlight:${fg};--prosemirror-highlight-bg:${bg}` : "");
|
|
16
16
|
if (style) {
|
|
17
17
|
const decoration = Decoration.node(pos, pos + size, { style });
|
|
18
18
|
decorations.push(decoration);
|
package/dist/sugar-high.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
// src/sugar-high.ts
|
|
2
2
|
import { Decoration } from "prosemirror-view";
|
|
3
|
-
import { tokenize } from "sugar-high";
|
|
4
|
-
var types =
|
|
5
|
-
"identifier",
|
|
6
|
-
"keyword",
|
|
7
|
-
"string",
|
|
8
|
-
"class",
|
|
9
|
-
"property",
|
|
10
|
-
"entity",
|
|
11
|
-
"jsxliterals",
|
|
12
|
-
"sign",
|
|
13
|
-
"comment",
|
|
14
|
-
"break",
|
|
15
|
-
"space"
|
|
16
|
-
];
|
|
3
|
+
import { tokenize, SugarHigh } from "sugar-high";
|
|
4
|
+
var types = SugarHigh.TokenTypes;
|
|
17
5
|
function createParser() {
|
|
18
6
|
return function parser({ content, pos }) {
|
|
19
7
|
const decorations = [];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prosemirror-highlight",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.2",
|
|
5
5
|
"description": "A ProseMirror plugin to highlight code blocks",
|
|
6
6
|
"author": "ocavue <ocavue@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"prosemirror-view": "^1.32.4",
|
|
61
61
|
"refractor": "^4.8.1",
|
|
62
62
|
"shiki": "^1.9.0 || ^2.0.0",
|
|
63
|
-
"sugar-high": "^0.6.1 || ^0.7.0 || ^0.8.0"
|
|
63
|
+
"sugar-high": "^0.6.1 || ^0.7.0 || ^0.8.0 || ^0.9.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"@types/hast": {
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"prosemirror-view": "^1.37.2",
|
|
113
113
|
"refractor": "^4.8.1",
|
|
114
114
|
"shiki": "^2.1.0",
|
|
115
|
-
"sugar-high": "^0.
|
|
115
|
+
"sugar-high": "^0.9.2",
|
|
116
116
|
"tsup": "^8.3.5",
|
|
117
117
|
"typescript": "^5.7.2",
|
|
118
118
|
"vite": "^6.0.11",
|