@kubohiroya/turbowarp-markdown 0.5.0 → 0.6.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.ja.md +10 -0
- package/README.md +11 -1
- package/dist/turbowarp-markdown.js +1 -1
- package/package.json +3 -3
package/README.ja.md
CHANGED
|
@@ -28,6 +28,16 @@ TurboWarp 上で Markdown を immutable な構造化フラグメントとして
|
|
|
28
28
|
|
|
29
29
|
`turbowarp-http-server` とは npm パッケージ依存では結合しません。Markdown 拡張で作ったフラグメントを `render Markdown` で文字列化し、HTTP レスポンス本文として渡してください。content type は `text/markdown; charset=utf-8` を明示する想定です。
|
|
30
30
|
|
|
31
|
+
## Document Dataで解析・読み取りする
|
|
32
|
+
|
|
33
|
+
`turbowarp-markdown:v1:`の値は組み立て用の形式で、読み取るための木ではありません。箇条書きの項目やinlineの中身が入れ子の`sequence`に入ることがあり、中身が1つのときと複数のときで形も変わります。組み立てた文書の一部を読み取ったり置き換えたり、構造を順にたどったりするときは、`render Markdown`で文字列にして[TurboWarp Document Data](https://github.com/kubohiroya/turbowarp-document-data)へ渡してください。
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
parse Markdown (render Markdown (fragment)) as document [doc]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Document Dataは解析したMarkdownをmdastの木として保持し、子は常に平らな`children`配列に並びます。位置を指定してtextを読み取り・置き換えるblockがあります。2つの拡張はnpmパッケージ依存を持たず、描画した文字列だけを受け渡すため、この拡張はサンドボックス内のまま動作します。Document Data自体はサンドボックスなしで動作します。
|
|
40
|
+
|
|
31
41
|
## 開発
|
|
32
42
|
|
|
33
43
|
```bash
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ pnpm install --frozen-lockfile
|
|
|
44
44
|
The package is version-pinned when used from npm:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
pnpm add --save-exact @kubohiroya/turbowarp-markdown@0.
|
|
47
|
+
pnpm add --save-exact @kubohiroya/turbowarp-markdown@0.6.0
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## Quick Start
|
|
@@ -266,6 +266,16 @@ Use `render Markdown [FRAGMENT]` when validation is not needed. Use `render Mark
|
|
|
266
266
|
|
|
267
267
|
Validation is intentionally lightweight. It catches common mistakes such as a `list item` used outside a list and block fragments nested inside inline-only fragments. It also warns about empty documents, empty lists, empty headings, and links without visible content or destinations.
|
|
268
268
|
|
|
269
|
+
## Parse and read with Document Data
|
|
270
|
+
|
|
271
|
+
The `turbowarp-markdown:v1:` values are a build format, not a tree meant for reading: list items and inline content can sit inside nested `sequence` fragments, and a fragment with one child has a different shape from one with several. To read or replace parts of a document you built, or to walk its structure, render it and pass the string to [TurboWarp Document Data](https://github.com/kubohiroya/turbowarp-document-data):
|
|
272
|
+
|
|
273
|
+
```text
|
|
274
|
+
parse Markdown (render Markdown (fragment)) as document [doc]
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Document Data keeps the parsed Markdown as an mdast tree whose children are always flat `children` arrays, and its blocks read and replace text by location. The two extensions share no package dependency and exchange only the rendered string, so this extension keeps running in the sandbox; Document Data itself runs without the sandbox.
|
|
278
|
+
|
|
269
279
|
## Development
|
|
270
280
|
|
|
271
281
|
```bash
|
|
@@ -20,7 +20,7 @@ var extensionConfig = {
|
|
|
20
20
|
blockIconURI: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0OCA0OCI+PHJlY3QgeD0iNiIgeT0iOCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjMyIiByeD0iNCIgZmlsbD0iIzJGNjM4NiIvPjxwYXRoIGQ9Ik0xMyAzMFYxOGw1IDcgNS03djEyTTI3LjUgMjB2MTBNMjcuNSAyMGgyLjVhNSA1IDAgMCAxIDAgMTBoLTIuNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg=="
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
|
23
|
-
//#region node_modules/.pnpm/@kubohiroya+turbowarp-extension-data-editor@0.
|
|
23
|
+
//#region node_modules/.pnpm/@kubohiroya+turbowarp-extension-data-editor@0.8.1_react@18.3.1/node_modules/@kubohiroya/turbowarp-extension-data-editor/dist/fixed-input-schema.js
|
|
24
24
|
var numberToken = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/u;
|
|
25
25
|
var invalidNumber = Object.freeze({
|
|
26
26
|
kind: "invalid",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-markdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "An immutable Markdown builder extension for TurboWarp.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hiroya Kubo",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@eslint/js": "^9.39.5",
|
|
70
70
|
"@kubohiroya/turbowarp-extension-manifest": "^0.5.0",
|
|
71
|
-
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.
|
|
71
|
+
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.11.0",
|
|
72
72
|
"@types/node": "^24.13.3",
|
|
73
73
|
"eslint": "^9.39.5",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
75
|
"typescript-eslint": "^8.66.0",
|
|
76
76
|
"vite": "^8.2.2",
|
|
77
77
|
"vitest": "^4.1.10",
|
|
78
|
-
"@kubohiroya/turbowarp-extension-data-editor": "^0.
|
|
78
|
+
"@kubohiroya/turbowarp-extension-data-editor": "^0.8.1"
|
|
79
79
|
},
|
|
80
80
|
"gitHead": "a02baff13a8da2f82f8807d33fdc6c50e8505cb4",
|
|
81
81
|
"x-turbowarp-source": {
|