@riebeckite/plugin-qr-code 0.0.31 → 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 +8 -1
- package/README_ja.md +10 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -7
- package/dist/src/rehype.d.ts +1 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -43,6 +43,13 @@ https://example.com/
|
|
|
43
43
|
The fence body is the text or URL to encode (trimmed). An empty body leaves the
|
|
44
44
|
code block untouched and reports a `@riebeckite/plugin-qr-code` diagnostic.
|
|
45
45
|
|
|
46
|
+
## Live example
|
|
47
|
+
|
|
48
|
+
~~~qr
|
|
49
|
+
# caption: Project page
|
|
50
|
+
https://example.com/
|
|
51
|
+
~~~
|
|
52
|
+
|
|
46
53
|
## Behavior
|
|
47
54
|
|
|
48
55
|
Each block becomes:
|
|
@@ -95,7 +102,7 @@ The caption comes from the code-block `title` (code meta) or a leading
|
|
|
95
102
|
## Exports
|
|
96
103
|
|
|
97
104
|
- `qrCode(options?)` — plugin factory
|
|
98
|
-
- `
|
|
105
|
+
- `qrCode` — alias of `qrCode`
|
|
99
106
|
- `resolveQrCodeOptions(options?)` — normalise options
|
|
100
107
|
- `buildQrSvg(text, options)` — encode text into an SVG string
|
|
101
108
|
- Types: `QrCodeOptions`, `ResolvedQrCodeOptions`, `QrCodeLevel`,
|
package/README_ja.md
CHANGED
|
@@ -39,6 +39,13 @@ https://example.com/
|
|
|
39
39
|
|
|
40
40
|
フェンス本文がエンコード対象のテキストまたは URL です(前後の空白は除去します)。本文が空の場合、コードブロックはそのまま残し、`@riebeckite/plugin-qr-code` を発行元とする診断を出します。
|
|
41
41
|
|
|
42
|
+
## 実行例
|
|
43
|
+
|
|
44
|
+
~~~qr
|
|
45
|
+
# caption: Project page
|
|
46
|
+
https://example.com/
|
|
47
|
+
~~~
|
|
48
|
+
|
|
42
49
|
## 出力
|
|
43
50
|
|
|
44
51
|
各ブロックは次の形になります。
|
|
@@ -60,7 +67,7 @@ https://example.com/
|
|
|
60
67
|
|
|
61
68
|
### エンコーダの読み込み
|
|
62
69
|
|
|
63
|
-
QR エンコーダ(`qrcode
|
|
70
|
+
QR エンコーダ(`qrcode`)はビルド時に動的インポートするため、サイト側・クライアント側のバンドルには含まれません。プラグインが一時的な設定モジュールへバンドルされ、ベア指定子を解決できなくなった場合は、`process.cwd()` と pnpm の仮想ストアから `node_modules` を探索してフォールバックします。
|
|
64
71
|
|
|
65
72
|
## オプション
|
|
66
73
|
|
|
@@ -72,7 +79,7 @@ QR エンコーダ(`qrcode`)はビルド時に動的インポートするた
|
|
|
72
79
|
| `dark` | `string` | `"#000000"` | 暗モジュールの色 |
|
|
73
80
|
| `light` | `string` | `"#ffffff"` | 明モジュールの色 |
|
|
74
81
|
| `caption` | `boolean` | `true` | タイトルまたは `# caption:` 行をキャプションとして表示する |
|
|
75
|
-
| `className` | `string` | `"rb-qr"` | figure の CSS クラス |
|
|
82
|
+
| `className` | `string` | `"rb-qr"` | `<figure>` の CSS クラス |
|
|
76
83
|
| `language` | `string` | `"qr"` | 対象とするフェンス言語 |
|
|
77
84
|
|
|
78
85
|
キャプションはコードブロックの `title`(コードメタ)または先頭の `# caption: …` 行から取得します。先頭のキャプション行はエンコード対象から取り除きます。
|
|
@@ -80,7 +87,7 @@ QR エンコーダ(`qrcode`)はビルド時に動的インポートするた
|
|
|
80
87
|
## 主なエクスポート
|
|
81
88
|
|
|
82
89
|
- `qrCode(options?)`: プラグインを作成する
|
|
83
|
-
- `
|
|
90
|
+
- `qrCode`: `qrCode` の別名
|
|
84
91
|
- `resolveQrCodeOptions(options?)`: オプションを正規化する
|
|
85
92
|
- `buildQrSvg(text, options)`: テキストを SVG 文字列へエンコードする
|
|
86
93
|
- 型: `QrCodeOptions`、`ResolvedQrCodeOptions`、`QrCodeLevel`、`QrBuildResult`
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ export { resolveQrCodeOptions } from "./src/options.js";
|
|
|
4
4
|
export { buildQrSvg } from "./src/render.js";
|
|
5
5
|
export type { QrBuildResult, QrCodeLevel, QrCodeOptions, ResolvedQrCodeOptions, } from "./src/types.js";
|
|
6
6
|
export declare function qrCode(options?: QrCodeOptions): import("@riebeckite/core").RiebeckitePlugin<QrCodeOptions>;
|
|
7
|
-
export declare const qrCodePlugin: typeof qrCode;
|
|
8
7
|
export { DEFAULT_QR_CODE_OPTIONS };
|
package/dist/index.js
CHANGED
|
@@ -271,12 +271,8 @@ var init_render = __esm({
|
|
|
271
271
|
// src/rehype.ts
|
|
272
272
|
var rehype_exports = {};
|
|
273
273
|
__export(rehype_exports, {
|
|
274
|
-
element: () => element,
|
|
275
274
|
getTextContent: () => getTextContent,
|
|
276
|
-
|
|
277
|
-
rehypeQrCode: () => rehypeQrCode,
|
|
278
|
-
text: () => text,
|
|
279
|
-
visitElements: () => visitElements
|
|
275
|
+
rehypeQrCode: () => rehypeQrCode
|
|
280
276
|
});
|
|
281
277
|
function rehypeQrCode(options) {
|
|
282
278
|
return async (tree, file) => {
|
|
@@ -515,7 +511,6 @@ function qrCode(options = {}) {
|
|
|
515
511
|
]
|
|
516
512
|
});
|
|
517
513
|
}
|
|
518
|
-
var qrCodePlugin = qrCode;
|
|
519
514
|
function validateQrCodeOptions(options) {
|
|
520
515
|
if (!options) return [];
|
|
521
516
|
const issues = [];
|
|
@@ -562,6 +557,5 @@ export {
|
|
|
562
557
|
DEFAULT_QR_CODE_OPTIONS,
|
|
563
558
|
buildQrSvg,
|
|
564
559
|
qrCode,
|
|
565
|
-
qrCodePlugin,
|
|
566
560
|
resolveQrCodeOptions
|
|
567
561
|
};
|
package/dist/src/rehype.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HastNode, ResolvedQrCodeOptions } from "./types.js";
|
|
2
2
|
export declare function rehypeQrCode(options: ResolvedQrCodeOptions): (tree: HastNode, file: unknown) => Promise<void>;
|
|
3
|
-
export declare function element(tagName: string, properties?: Record<string, unknown>, children?: HastNode[]): ElementNode;
|
|
4
|
-
export declare function text(value: string): TextNode;
|
|
5
|
-
export declare function raw(value: string): RawNode;
|
|
6
3
|
export declare function getTextContent(node: HastNode): string;
|
|
7
|
-
export declare function visitElements(node: HastNode, visitor: (node: ElementNode, parent?: ParentNode, index?: number) => void, parent?: ParentNode, index?: number): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-qr-code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"./style.css": "./style.css"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"@riebeckite/core": "0.0.33",
|
|
19
|
+
"qrcode": "^1.5.4"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|