@riebeckite/plugin-code-enhance 0.0.32 → 0.0.33

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 CHANGED
@@ -35,6 +35,16 @@ export default defineConfig({
35
35
  });
36
36
  ```
37
37
 
38
+ ## Live example
39
+
40
+ The block below uses a filename header, line numbers, and a highlighted line.
41
+
42
+ ~~~ts title="greeting.ts" {2}
43
+ export function greet(name: string) {
44
+ return `Hello, ${name}`;
45
+ }
46
+ ~~~
47
+
38
48
  ## Features
39
49
 
40
50
  - Syntax highlighting via Shiki (rehype-pretty-code)
package/README_ja.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <!-- Generated from docs/docs/plugins/code-enhance.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
4
 
5
- Shiki によるシンタックスハイライトへ、コピー、折り返し、折りたたみなどの操作を加えるプラグインです。
5
+ Shiki のシンタックスハイライトに、ファイル名ヘッダーとコピー、折り返し、折りたたみの操作を加えたコードブロックを提供するプラグインです。
6
6
 
7
7
  [English](./README.md)
8
8
 
@@ -20,6 +20,16 @@ export default defineConfig({
20
20
 
21
21
  `codeEnhance()` は `rehype-pretty-code` を使ってコードブロックを処理し、ファイル名と操作ボタンを持つ `.rr-code` 要素に整えます。ボタンの操作はクライアントエントリーが担当します。
22
22
 
23
+ ## 実行例
24
+
25
+ 次のブロックでは、ファイル名ヘッダー、行番号、行ハイライトを同時に使っています。
26
+
27
+ ~~~ts title="greeting.ts" {2}
28
+ export function greet(name: string) {
29
+ return `Hello, ${name}`;
30
+ }
31
+ ~~~
32
+
23
33
  ## 表示と操作
24
34
 
25
35
  - Shiki のテーマによる色付け、行番号、メタデータによる行・文字の強調
@@ -29,7 +39,7 @@ export default defineConfig({
29
39
  - `bash`、`console`、`sh` などのシェル言語の行に `$` を付ける
30
40
  - キーボードで内容を確認できるよう、`<pre>` をフォーカス可能にする
31
41
 
32
- Theme は `rr-code` の root に `--rr-code-syntax` を指定すると、ハイライト済みコードの
42
+ テーマは `rr-code` のルート要素に `--rr-code-syntax` を指定すると、ハイライト済みコードの
33
43
  子要素を選択せずに構文色を指定できます。
34
44
 
35
45
  ## オプション
@@ -51,12 +61,12 @@ Theme は `rr-code` の root に `--rr-code-syntax` を指定すると、ハイ
51
61
 
52
62
  ## クライアント側の初期化
53
63
 
54
- `codeEnhance()` は `copyLabel` と `copiedLabel` をクライアントエントリーへ渡します。`initCodeEnhance(options?)` はコピー、折り返し、折りたたみボタンのために document 全体のクリックハンドラーを登録します。直接呼び出す場合も同じ二つの文言を指定できます。
64
+ `codeEnhance()` は `copyLabel` と `copiedLabel` をクライアントエントリーへ渡します。`initCodeEnhance(options?)` はコピー、折り返し、折りたたみボタンのためにドキュメント全体のクリックハンドラーを登録します。直接呼び出す場合も同じ 2 つの文言を指定できます。
55
65
 
56
66
  ## 公開 API
57
67
 
58
68
  - `codeEnhance(options?)`:プラグインファクトリ
59
- - `rehypeCodeEnhance(options?)`:Rehype 変換
69
+ - `rehypeCodeEnhance(options?)`:rehype 変換
60
70
  - `initCodeEnhance(options?)`:ブラウザ初期化関数
61
71
  - `DEFAULT_COPY_LABEL`、`DEFAULT_COPIED_LABEL`:既定のコピー文言
62
72
  - `CodeEnhanceOptions`、`CodeEnhanceClientOptions`、`CodeEnhanceTheme`:型
@@ -1,6 +1,5 @@
1
1
  import type { ElementNode, HastNode, TextNode } from "./types.js";
2
2
  export declare function visitElements(node: HastNode, visitor: (node: ElementNode, parent?: ElementNode, index?: number) => void, parent?: ElementNode, index?: number): void;
3
- export declare function isElementNode(node: HastNode): node is ElementNode;
4
3
  export declare function text(value: string): TextNode;
5
4
  export declare function element(tagName: string, properties?: Record<string, unknown>, children?: HastNode[]): ElementNode;
6
5
  export declare function getStringProperty(node: ElementNode, key: string): string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-code-enhance",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,9 +21,9 @@
21
21
  "./style.css": "./style.css"
22
22
  },
23
23
  "dependencies": {
24
+ "@riebeckite/core": "0.0.33",
24
25
  "rehype-pretty-code": "^0.14.1",
25
- "shiki": "^3.13.0",
26
- "@riebeckite/core": "0.0.32"
26
+ "shiki": "^3.13.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "tsx": "^4.22.4"