@riebeckite/plugin-code-enhance 0.0.23 → 0.0.24
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 +2 -2
- package/README_ja.md +2 -2
- package/dist/index.js +5 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ export default defineConfig({
|
|
|
45
45
|
- Collapse / expand button (opt-in, client)
|
|
46
46
|
- Line numbers (`data-line-number` gutter)
|
|
47
47
|
- Line and character highlighting from pretty-code meta (`{1,3}`, `[/re/]`)
|
|
48
|
-
- Diff coloring for lines
|
|
48
|
+
- Diff coloring for `+` / `-` lines in `diff` code blocks
|
|
49
49
|
- Terminal styling for `bash`, `console`, `sh`, `shell`, `terminal`, `zsh`
|
|
50
50
|
(inverted palette) with a `$` prompt prefix on non-empty lines
|
|
51
51
|
- Focusable `<pre>` (`tabindex="0"`) for keyboard scrolling
|
|
@@ -59,7 +59,7 @@ export default defineConfig({
|
|
|
59
59
|
| `copyButton` | `boolean` | `true` | Show the copy button |
|
|
60
60
|
| `filename` | `boolean` | `true` | Show the file name in the header |
|
|
61
61
|
| `lineHighlight` | `boolean` | `true` | Apply meta-based line/char highlights |
|
|
62
|
-
| `diffHighlight` | `boolean` | `true` | Color `+` / `-` lines |
|
|
62
|
+
| `diffHighlight` | `boolean` | `true` | Color `+` / `-` lines in `diff` blocks |
|
|
63
63
|
| `collapsible` | `boolean` | `false` | Add the collapse button |
|
|
64
64
|
| `terminal` | `boolean` | `true` | Terminal styling for shell languages |
|
|
65
65
|
| `commandPrompt` | `boolean` | `true` | `$` prompt prefix on terminal lines |
|
package/README_ja.md
CHANGED
|
@@ -23,7 +23,7 @@ export default defineConfig({
|
|
|
23
23
|
## 表示と操作
|
|
24
24
|
|
|
25
25
|
- Shiki のテーマによる色付け、行番号、メタデータによる行・文字の強調
|
|
26
|
-
- `+` と `-` で始まる行の差分表示
|
|
26
|
+
- `diff` コードブロックの `+` と `-` で始まる行の差分表示
|
|
27
27
|
- コピー、折り返し、任意の折りたたみ
|
|
28
28
|
- `bash`、`console`、`sh` などを端末風に表示し、必要に応じて `$` を付ける
|
|
29
29
|
- キーボードで内容を確認できるよう、`<pre>` をフォーカス可能にする
|
|
@@ -37,7 +37,7 @@ export default defineConfig({
|
|
|
37
37
|
| `copyButton` | `boolean` | `true` | コピーボタンを表示する |
|
|
38
38
|
| `filename` | `boolean` | `true` | ヘッダーにファイル名を表示する |
|
|
39
39
|
| `lineHighlight` | `boolean` | `true` | メタデータによる行・文字の強調を適用する |
|
|
40
|
-
| `diffHighlight` | `boolean` | `true` | `+` / `-` で始まる行を色付けする |
|
|
40
|
+
| `diffHighlight` | `boolean` | `true` | `diff` コードブロックの `+` / `-` で始まる行を色付けする |
|
|
41
41
|
| `collapsible` | `boolean` | `false` | 折りたたみボタンを追加する |
|
|
42
42
|
| `terminal` | `boolean` | `true` | シェル言語を端末風に表示する |
|
|
43
43
|
| `commandPrompt` | `boolean` | `true` | 端末の各行に `$` を付ける |
|
package/dist/index.js
CHANGED
|
@@ -251,7 +251,8 @@ function enhancePrettyCodeFigures(tree, options) {
|
|
|
251
251
|
className: mergeClassName(code.properties?.className, "rr-code__code")
|
|
252
252
|
};
|
|
253
253
|
if (options.lineNumbers) markLineNumbers(code);
|
|
254
|
-
if (options.diffHighlight !== false
|
|
254
|
+
if (options.diffHighlight !== false && isDiffLanguage(language))
|
|
255
|
+
markDiffLines(code);
|
|
255
256
|
if (options.commandPrompt !== false && isTerminal)
|
|
256
257
|
markCommandPrompts(code);
|
|
257
258
|
}
|
|
@@ -398,6 +399,9 @@ function isTerminalLanguage(language) {
|
|
|
398
399
|
language
|
|
399
400
|
);
|
|
400
401
|
}
|
|
402
|
+
function isDiffLanguage(language) {
|
|
403
|
+
return ["diff"].includes(language.toLowerCase());
|
|
404
|
+
}
|
|
401
405
|
|
|
402
406
|
// src/remark.ts
|
|
403
407
|
function remarkCodeMeta() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-code-enhance",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"rehype-pretty-code": "^0.14.1",
|
|
25
25
|
"shiki": "^3.13.0",
|
|
26
|
-
"@riebeckite/core": "0.0.
|
|
26
|
+
"@riebeckite/core": "0.0.24"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsx": "^4.22.4"
|