remark-dl-list 0.1.2 → 0.1.3
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 +21 -21
- package/README.md +21 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README-ja.md
CHANGED
|
@@ -6,6 +6,24 @@
|
|
|
6
6
|
このプラグインは remark に定義リストのサポートを追加し、
|
|
7
7
|
Markdown へのラウンドトリップ(再シリアライズ)を可能にします。
|
|
8
8
|
|
|
9
|
+
構文:
|
|
10
|
+
|
|
11
|
+
```md
|
|
12
|
+
: term
|
|
13
|
+
: description
|
|
14
|
+
: another description
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
は次のように変換されます。
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<dl>
|
|
21
|
+
<dt>term</dt>
|
|
22
|
+
<dd>description</dd>
|
|
23
|
+
<dd>another description</dd>
|
|
24
|
+
</dl>
|
|
25
|
+
```
|
|
26
|
+
|
|
9
27
|
定義リストの詳細な構文については、
|
|
10
28
|
→ **[docs/syntax-ja.md](https://github.com/kanemu/unified-dl-list/blob/main/docs/syntax-ja.md)** を参照してください。
|
|
11
29
|
|
|
@@ -29,7 +47,7 @@ pnpm add remark-dl-list
|
|
|
29
47
|
import { unified } from 'unified'
|
|
30
48
|
import remarkParse from 'remark-parse'
|
|
31
49
|
import remarkStringify from 'remark-stringify'
|
|
32
|
-
import
|
|
50
|
+
import remarkDlList from 'remark-dl-list'
|
|
33
51
|
|
|
34
52
|
const md = `
|
|
35
53
|
: term1
|
|
@@ -70,7 +88,7 @@ import { unified } from 'unified'
|
|
|
70
88
|
import remarkParse from 'remark-parse'
|
|
71
89
|
import remarkRehype from 'remark-rehype'
|
|
72
90
|
import rehypeStringify from 'rehype-stringify'
|
|
73
|
-
import
|
|
91
|
+
import remarkDlList from 'remark-dl-list'
|
|
74
92
|
import { dlListHandlers } from 'hast-util-dl-list'
|
|
75
93
|
|
|
76
94
|
const html = await unified()
|
|
@@ -104,7 +122,7 @@ import remarkGfm from 'remark-gfm'
|
|
|
104
122
|
import remarkRehype from 'remark-rehype'
|
|
105
123
|
import rehypeStringify from 'rehype-stringify'
|
|
106
124
|
|
|
107
|
-
import
|
|
125
|
+
import remarkDlList from 'remark-dl-list'
|
|
108
126
|
import { dlListHandlers } from 'hast-util-dl-list'
|
|
109
127
|
|
|
110
128
|
const processor = unified()
|
|
@@ -162,24 +180,6 @@ console.log(html)
|
|
|
162
180
|
* 単体で HTML を生成しません
|
|
163
181
|
* 定義リスト構文が存在しない場合の通常の Markdown の挙動は変更しません
|
|
164
182
|
|
|
165
|
-
## 構文
|
|
166
|
-
|
|
167
|
-
```md
|
|
168
|
-
: term
|
|
169
|
-
: description
|
|
170
|
-
: another description
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
は次のように変換されます。
|
|
174
|
-
|
|
175
|
-
```html
|
|
176
|
-
<dl>
|
|
177
|
-
<dt>term</dt>
|
|
178
|
-
<dd>description</dd>
|
|
179
|
-
<dd>another description</dd>
|
|
180
|
-
</dl>
|
|
181
|
-
```
|
|
182
|
-
|
|
183
183
|
## 関連パッケージ
|
|
184
184
|
|
|
185
185
|
このパッケージは **[unified-dl-list](https://github.com/kanemu/unified-dl-list)** モノレポの一部です。
|
package/README.md
CHANGED
|
@@ -6,6 +6,24 @@ using `<dl>`, `<dt>`, and `<dd>` syntax.
|
|
|
6
6
|
This plugin adds support for definition lists to remark and allows
|
|
7
7
|
round-trip serialization back to markdown.
|
|
8
8
|
|
|
9
|
+
Syntax:
|
|
10
|
+
|
|
11
|
+
```md
|
|
12
|
+
: term
|
|
13
|
+
: description
|
|
14
|
+
: another description
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
is converted to:
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<dl>
|
|
21
|
+
<dt>term</dt>
|
|
22
|
+
<dd>description</dd>
|
|
23
|
+
<dd>another description</dd>
|
|
24
|
+
</dl>
|
|
25
|
+
```
|
|
26
|
+
|
|
9
27
|
For the detailed definition list syntax,
|
|
10
28
|
→ **[docs/syntax.md](https://github.com/kanemu/unified-dl-list/blob/main/docs/syntax.md)**.
|
|
11
29
|
|
|
@@ -29,7 +47,7 @@ pnpm add remark-dl-list
|
|
|
29
47
|
import { unified } from 'unified'
|
|
30
48
|
import remarkParse from 'remark-parse'
|
|
31
49
|
import remarkStringify from 'remark-stringify'
|
|
32
|
-
import
|
|
50
|
+
import remarkDlList from 'remark-dl-list'
|
|
33
51
|
|
|
34
52
|
const md = `
|
|
35
53
|
: term1
|
|
@@ -70,7 +88,7 @@ import { unified } from 'unified'
|
|
|
70
88
|
import remarkParse from 'remark-parse'
|
|
71
89
|
import remarkRehype from 'remark-rehype'
|
|
72
90
|
import rehypeStringify from 'rehype-stringify'
|
|
73
|
-
import
|
|
91
|
+
import remarkDlList from 'remark-dl-list'
|
|
74
92
|
import { dlListHandlers } from 'hast-util-dl-list'
|
|
75
93
|
|
|
76
94
|
const html = await unified()
|
|
@@ -103,7 +121,7 @@ import remarkGfm from 'remark-gfm'
|
|
|
103
121
|
import remarkRehype from 'remark-rehype'
|
|
104
122
|
import rehypeStringify from 'rehype-stringify'
|
|
105
123
|
|
|
106
|
-
import
|
|
124
|
+
import remarkDlList from 'remark-dl-list'
|
|
107
125
|
import { dlListHandlers } from 'hast-util-dl-list'
|
|
108
126
|
|
|
109
127
|
const processor = unified()
|
|
@@ -172,24 +190,6 @@ Output:
|
|
|
172
190
|
* Does **not** generate HTML by itself
|
|
173
191
|
* Does **not** change normal markdown behavior when no dl syntax is present
|
|
174
192
|
|
|
175
|
-
## Syntax
|
|
176
|
-
|
|
177
|
-
```md
|
|
178
|
-
: term
|
|
179
|
-
: description
|
|
180
|
-
: another description
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
is converted to:
|
|
184
|
-
|
|
185
|
-
```html
|
|
186
|
-
<dl>
|
|
187
|
-
<dt>term</dt>
|
|
188
|
-
<dd>description</dd>
|
|
189
|
-
<dd>another description</dd>
|
|
190
|
-
</dl>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
193
|
## Related packages
|
|
194
194
|
|
|
195
195
|
This package is part of the **[unified-dl-list](https://github.com/kanemu/unified-dl-list)** monorepo:
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { dlList } from \"micromark-extension-dl-list\";\nimport { dlListFromMarkdown, dlListToMarkdown } from \"mdast-util-dl-list\";\n\nimport type { Processor } from \"unified\";\nimport type { Extension as MicromarkExtension } from \"micromark-util-types\";\nimport type { Extension as FromMarkdownExtension } from \"mdast-util-from-markdown\";\nimport type { Options as ToMarkdownOptions } from \"mdast-util-to-markdown\";\n\ntype ToMarkdownExtension =\n NonNullable<ToMarkdownOptions[\"extensions\"]>[number];\n\n/**\n * remark plugin that enables colon-based definition lists using `<dl>`, `<dt>`, and `<dd>`.\n *\n * This plugin wires:\n * - micromark extension (syntax)\n * - mdast from-markdown extension (AST generation)\n * - mdast to-markdown extension (serialization)\n *\n * What this plugin intentionally does NOT do:\n * - It does NOT install `remark-rehype`.\n * - It does NOT register hast handlers automatically.\n *\n * If you need HTML output, combine this plugin with:\n * - `remark-rehype`\n * - `hast-util-dl-list`\n *\n * Example:\n *\n * ```ts\n * unified()\n * .use(remarkParse)\n * .use(remarkDlList)\n * .use(remarkRehype, { handlers: dlListHandlers() })\n * ```\n */\nexport function remarkDlList(this: Processor): void {\n const data = this.data() as Record<string, unknown>;\n\n const micromarkExtensions =\n (data.micromarkExtensions as MicromarkExtension[] | undefined) ??\n ((data.micromarkExtensions = []) as MicromarkExtension[]);\n\n const fromMarkdownExtensions =\n (data.fromMarkdownExtensions as FromMarkdownExtension[] | undefined) ??\n ((data.fromMarkdownExtensions = []) as FromMarkdownExtension[]);\n\n const toMarkdownExtensions =\n (data.toMarkdownExtensions as ToMarkdownExtension[] | undefined) ??\n ((data.toMarkdownExtensions = []) as ToMarkdownExtension[]);\n\n // Capture “other” extensions that are already registered at this moment.\n // These will be inherited by dd/dt reparse inside mdast-util-dl-list.\n const inheritedMicromark = micromarkExtensions.slice();\n const inheritedFromMd = fromMarkdownExtensions.slice();\n\n // Register dl-list itself\n micromarkExtensions.push(dlList());\n\n // IMPORTANT: pass inherited extensions to dlListFromMarkdown so dd reparse can see them\n fromMarkdownExtensions.push(\n dlListFromMarkdown({\n extensions: inheritedMicromark as any,\n mdastExtensions: inheritedFromMd as any,\n })\n );\n\n toMarkdownExtensions.push(dlListToMarkdown());\n}"],"mappings":";AAAA,SAAS,cAAc;AACvB,SAAS,oBAAoB,wBAAwB;AAmC9C,SAAS,eAAoC;AAChD,QAAM,OAAO,KAAK,KAAK;AAEvB,QAAM,sBACD,KAAK,wBACJ,KAAK,sBAAsB,CAAC;AAElC,QAAM,yBACD,KAAK,2BACJ,KAAK,yBAAyB,CAAC;AAErC,QAAM,uBACD,KAAK,yBACJ,KAAK,uBAAuB,CAAC;AAInC,QAAM,qBAAqB,oBAAoB,MAAM;AACrD,QAAM,kBAAkB,uBAAuB,MAAM;AAGrD,sBAAoB,KAAK,OAAO,CAAC;AAGjC,yBAAuB;AAAA,IACnB,mBAAmB;AAAA,MACf,YAAY;AAAA,MACZ,iBAAiB;AAAA,IACrB,CAAC;AAAA,EACL;AAEA,uBAAqB,KAAK,iBAAiB,CAAC;AAChD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { dlList } from \"micromark-extension-dl-list\";\nimport { dlListFromMarkdown, dlListToMarkdown } from \"mdast-util-dl-list\";\n\nimport type { Processor } from \"unified\";\nimport type { Extension as MicromarkExtension } from \"micromark-util-types\";\nimport type { Extension as FromMarkdownExtension } from \"mdast-util-from-markdown\";\nimport type { Options as ToMarkdownOptions } from \"mdast-util-to-markdown\";\n\ntype ToMarkdownExtension =\n NonNullable<ToMarkdownOptions[\"extensions\"]>[number];\n\n/**\n * remark plugin that enables colon-based definition lists using `<dl>`, `<dt>`, and `<dd>`.\n *\n * This plugin wires:\n * - micromark extension (syntax)\n * - mdast from-markdown extension (AST generation)\n * - mdast to-markdown extension (serialization)\n *\n * What this plugin intentionally does NOT do:\n * - It does NOT install `remark-rehype`.\n * - It does NOT register hast handlers automatically.\n *\n * If you need HTML output, combine this plugin with:\n * - `remark-rehype`\n * - `hast-util-dl-list`\n *\n * Example:\n *\n * ```ts\n * unified()\n * .use(remarkParse)\n * .use(remarkDlList)\n * .use(remarkRehype, { handlers: dlListHandlers() })\n * ```\n */\nexport function remarkDlList(this: Processor): void {\n const data = this.data() as Record<string, unknown>;\n\n const micromarkExtensions =\n (data.micromarkExtensions as MicromarkExtension[] | undefined) ??\n ((data.micromarkExtensions = []) as MicromarkExtension[]);\n\n const fromMarkdownExtensions =\n (data.fromMarkdownExtensions as FromMarkdownExtension[] | undefined) ??\n ((data.fromMarkdownExtensions = []) as FromMarkdownExtension[]);\n\n const toMarkdownExtensions =\n (data.toMarkdownExtensions as ToMarkdownExtension[] | undefined) ??\n ((data.toMarkdownExtensions = []) as ToMarkdownExtension[]);\n\n // Capture “other” extensions that are already registered at this moment.\n // These will be inherited by dd/dt reparse inside mdast-util-dl-list.\n const inheritedMicromark = micromarkExtensions.slice();\n const inheritedFromMd = fromMarkdownExtensions.slice();\n\n // Register dl-list itself\n micromarkExtensions.push(dlList());\n\n // IMPORTANT: pass inherited extensions to dlListFromMarkdown so dd reparse can see them\n fromMarkdownExtensions.push(\n dlListFromMarkdown({\n extensions: inheritedMicromark as any,\n mdastExtensions: inheritedFromMd as any,\n })\n );\n\n toMarkdownExtensions.push(dlListToMarkdown());\n}\n\nexport default remarkDlList\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,SAAS,oBAAoB,wBAAwB;AAmC9C,SAAS,eAAoC;AAChD,QAAM,OAAO,KAAK,KAAK;AAEvB,QAAM,sBACD,KAAK,wBACJ,KAAK,sBAAsB,CAAC;AAElC,QAAM,yBACD,KAAK,2BACJ,KAAK,yBAAyB,CAAC;AAErC,QAAM,uBACD,KAAK,yBACJ,KAAK,uBAAuB,CAAC;AAInC,QAAM,qBAAqB,oBAAoB,MAAM;AACrD,QAAM,kBAAkB,uBAAuB,MAAM;AAGrD,sBAAoB,KAAK,OAAO,CAAC;AAGjC,yBAAuB;AAAA,IACnB,mBAAmB;AAAA,MACf,YAAY;AAAA,MACZ,iBAAiB;AAAA,IACrB,CAAC;AAAA,EACL;AAEA,uBAAqB,KAAK,iBAAiB,CAAC;AAChD;AAEA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remark-dl-list",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A remark plugin that enables colon-based definition lists by wiring micromark and mdast extensions for <dl>, <dt>, and <dd>.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"mdast-util-dl-list": "^0.1.
|
|
33
|
-
"micromark-extension-dl-list": "^0.1.
|
|
32
|
+
"mdast-util-dl-list": "^0.1.3",
|
|
33
|
+
"micromark-extension-dl-list": "^0.1.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"unified": "^11.0.5"
|