@peaceroad/markdown-it-numbering-ul-regarded-as-ol 0.2.0 → 0.2.1

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
@@ -1,335 +1,336 @@
1
- # p7d-markdown-it-numbering-ul-regarded-as-ol
2
-
3
- Markdown's default ordered list markers are limited. This plugin extends Markdown's unordered lists so they can use many kinds of ordered markers.
4
-
5
- Also, this plugin option provides a description-list conversion. Unordered list items whose first line is wrapped in `**` and followed by two spaces are converted into `<dl>` elements.
6
-
7
- ## Ordered lists conversion behavior
8
-
9
- This plugin detects unordered lists that use number-like markers (for example `- a.`, `- ①`) and converts them into appropriate ordered lists (`<ol>`). During conversion the plugin also attaches informative attributes to the generated elements.
10
-
11
- Code. Conversion of a lowercase Roman numeral list.
12
-
13
- ```
14
- [Markdown]
15
- - i. First item
16
- - ii. Second item
17
- - iii. Third item
18
-
19
- [HTML]
20
- <ol type="i" class="ol-lower-roman" data-marker-suffix=".">
21
- <li>First item</li>
22
- <li>Second item</li>
23
- <li>Third item</li>
24
- </ol>
25
- ```
26
-
27
- ### Supported Marker Types
28
-
29
- The plugin supports the following marker types.
30
-
31
- - **HTML Standard Markers (with `type` attribute)**
32
- - decimal: `1`, `2`, `3`, pattern: common
33
- - lower-latin: `a`, `b`, `c`, pattern: common
34
- - upper-latin: `A`, `B`, `C`, pattern: common
35
- - lower-roman: `i`, `ii`, `iii`, pattern: common
36
- - upper-roman: `I`, `II`, `III`, pattern: common
37
- - **Custom Markers (with `role="list"`)**
38
- - circled-decimal: `①`, `②`, `③`, pattern: enclosed
39
- - filled-circled-decimal: `❶`, `❷`, `❸`, pattern: enclosed
40
- - circled-lower-latin: `ⓐ`, `ⓑ`, `ⓒ`, pattern: enclosed
41
- - circled-upper-latin: `Ⓐ`, `Ⓑ`, `Ⓒ`, pattern: enclosed
42
- - filled-circled-upper-latin: `🅐`, `🅑`, `🅒`, pattern: enclosed
43
- - squared-decimal: `1⃣`, `2⃣`, `3⃣`, pattern: enclosed
44
- - squared-upper-latin: `🄰`, `🄱`, `🄲`, pattern: enclosed
45
- - filled-squared-upper-latin: `🅰`, `🅱`, `🅲`, pattern: enclosed
46
- - fullwidth-lower-roman: `ⅰ`, `ⅱ`, `ⅲ`, pattern: fullwidth
47
- - fullwidth-upper-roman: `Ⅰ`, `Ⅱ`, `Ⅲ`, pattern: fullwidth
48
- - japanese-informal: `一`, `二`, `三`, pattern: fullwidth
49
- - katakana: `ア`, `イ`, `ウ`, pattern: fullwidth
50
- - katakana-iroha: `イ`, `ロ`, `ハ`, pattern: fullwidth
51
- - lower-greek: `α`, `β`, `γ`, pattern: common
52
-
53
- Marker separators differ depending on the character style used for the ordinal marker: ASCII markers (`- a.`, `- a)`, `(a)`), fullwidth markers (`- 一、`, `- 一.`), or enclosed glyphs (`- ①`, `- ❶`). The `pattern` value for each marker type indicates which separator rules apply:
54
-
55
- - `common`: examples include `a.`, `a)`, `(a)`;
56
- - `fullwidth`: includes fullwidth separators such as `イ.`, `イ)`, `(イ)`;
57
- - `enclosed`: enclosed glyphs like `①` which do not use `.` or `)` as separators.
58
-
59
- After the marker separator, an ASCII space is normally expected. For `fullwidth` and `enclosed` patterns a fullwidth space is accepted in place of the ASCII space; enclosed markers may also appear without a following space. See `listTypes.json` for the canonical marker definitions.
60
-
61
- ### Attributes and markers
62
-
63
- - The generated `<ol>` receives a `class` of the form `ol-<marker-name>`. For example, a `- a.` marker results in `class="ol-lower-latin"` on the `<ol>`.
64
- - Standard HTML markers (decimal, latin, roman) produce an `<ol>` with a `type` attribute (for example `type="1"`, `type="a"`, `type="i"`). Custom markers (circled numbers, Katakana, Kanji, etc.) do not set a `type` attribute by default; instead the plugin emits `role="list"` on the `<ol>`.
65
- - When the starting number is not `1`, the plugin adds a native `start` attribute to the `<ol>` for both standard and custom markers.
66
- - When a marker separator is present, the plugin adds `data-marker-prefix` and/or `data-marker-suffix` attributes with the matched strings. These attributes are omitted if there is no prefix/suffix (or if the suffix is visually only whitespace). For example, `- a.` results in `data-marker-suffix="."`.
67
- - For custom markers the plugin inserts the visible marker text inside a `span` with the configured `markerSpanClass` (default: `li-num`). Example: `- ①` becomes `<li><span class="li-num" aria-hidden="true">①</span> A item.</li>`.
68
- - When individual list item numbers jump, the plugin sets the native `value` attribute on the `li` element for both standard and custom markers.
69
-
70
- ### Structures
71
-
72
- - Marker type detection is deterministic: gather all markers at a nesting level, match them against the canonical definitions, keep the type that explains the most items while preserving numeric continuity, and use the order in `listTypes.json` only as a final tiebreaker.
73
- - Flattening: A pattern like `- 1.` is represented by the default `ul > li > ol` nesting structure in markdown-it, but this plugin simplifies it to a single `ol` by default to match the representation of other markers.
74
-
75
- Note: For custom marker lists (those rendered with `role="list"`) the plugin assumes you will hide the native marker via CSS (for example `ol[role="list"] { list-style: none; }`). The `hasListStyleNone` option can be enabled to add `style="list-style: none;"` directly to generated `<ol>` elements.
76
-
77
- ### Behavior customization
78
-
79
- You can customize the conversion using options.
80
-
81
- - `unremoveUlNest` (boolean) — If `true`, preserve the original `ul > li > ol` nesting instead of flattening into `ol > li`.
82
- - `alwaysMarkerSpan` (boolean) — Wrap markers in a `<span>` (class `markerSpanClass`, default: `li-num`). When markers are rendered as custom markers the plugin emits `role="list"` and does not set a `type` attribute on the `<ol>`.
83
- - `useCounterStyle` (boolean) — When `true` the plugin suppresses generated marker spans (no `span.li-num`) and prefers native `start`/`value` attributes so you can style lists with CSS `@counter-style`. Note that in this case the marker will not be selectable, as browsers currently do not support CSS `user-select` on markers.
84
- - `markerSpanClass` (string) — Specify the class name applied to the marker `<span>` (default: `li-num`).
85
- - `hasListStyleNone` (boolean) — When the plugin emits `role="list"`, also add `style="list-style: none;"` to the `<ol>`.
86
- - `omitMarkerMetadata` (boolean) — If `true`, omit the `data-marker-prefix` / `data-marker-suffix` attributes.
87
-
88
- ## Description lists conversion behavior
89
-
90
- When the `descriptionList` option is enabled the plugin converts specially formatted bullet lists into HTML description lists (`<dl>`).
91
-
92
- - Each list item must start with a `**Term**` line.
93
- - If the Term line is not separated from the description by a blank line, then the Term line must end with two ASCII spaces (a Markdown line-break) or a backslash `\` to indicate the description follows.
94
-
95
- In the conversion the `**Term**` line becomes a `<dt>` and the subsequent lines become the corresponding `<dd>`.
96
-
97
- Note: Currently the content inside `<dd>` elements is always wrapped in `<p>` elements.
98
-
99
- ### Description list options
100
-
101
- - `descriptionList` (boolean) — Enable conversion of `**Term**` list patterns into `<dl>` description lists.
102
- - `descriptionListWithDiv` (boolean) — Wrap `<dt>/<dd>` pairs in a `<div>` when enabled.
103
- - `descriptionListDivClass` (string) — Class applied to the wrapper `<div>` when `descriptionListWithDiv` is enabled (empty string disables the class).
104
-
105
- ## Examples: Ordered Lists
106
-
107
- HTML standard marker conversion (markers that set the `type` attribute). The plugin also accepts `)` as a separator in place of `.`:
108
-
109
- ```
110
- [Markdown]
111
- - A) First
112
- - B) Second
113
- - C) Third
114
-
115
- [HTML]
116
- <ol type="A" class="ol-upper-latin" data-marker-suffix=")">
117
- <li>First</li>
118
- <li>Second</li>
119
- <li>Third</li>
120
- </ol>
121
- ```
122
-
123
- Custom marker conversion example:
124
-
125
- ```
126
- [Markdown]
127
- - ① First
128
- - Second
129
- - Third
130
-
131
- [HTML]
132
- <ol role="list" class="ol-filled-circled-decimal">
133
- <li><span class="li-num" aria-hidden="true">①</span> First</li>
134
- <li><span class="li-num" aria-hidden="true">②</span> Second</li>
135
- <li><span class="li-num" aria-hidden="true">③</span> Third</li>
136
- </ol>
137
- <!-- In this case the stylesheet is expected to hide the native marker, e.g. ol[role="list"] { list-style: none; } -->
138
- ```
139
-
140
- Standard numeric markdown is converted as usual:
141
-
142
- ```
143
- [Markdown]
144
- 1. First item
145
- 2. Second item
146
-
147
- [HTML]
148
- <ol type="1" class="ol-decimal" data-marker-suffix=".">
149
- <li>First item</li>
150
- <li>Second item</li>
151
- </ol>
152
- ```
153
-
154
- For lists written in the `- 1.` style this plugin flattens the default `ul > li > ol` nesting into a single `ol > li` structure to match other conversion patterns:
155
-
156
- ```
157
- [Markdown]
158
- - 1. First item
159
- - 2. Second item
160
- - 3. Third item
161
-
162
- [HTML]
163
- <ol type="1" class="ol-decimal" data-marker-suffix=".">
164
- <li>First item</li>
165
- <li>Second item</li>
166
- <li>Third item</li>
167
- </ol>
168
- ```
169
-
170
- Nested lists are supported as well:
171
-
172
- ```
173
- [Markdown]
174
- - ② First item
175
- - i. Subitem A
176
- - iii. Subitem C
177
- - Second item
178
-
179
- [HTML]
180
- <ol role="list" start="2" class="ol-circled-decimal">
181
- <li><span class="li-num" aria-hidden="true">②</span> First item
182
- <ol type="i" class="ol-lower-roman" data-marker-suffix=".">
183
- <li>Subitem A</li>
184
- <li value="3">Subitem C</li>
185
- </ol>
186
- </li>
187
- <li value="4"><span class="li-num" aria-hidden="true">④</span> Second item</li>
188
- </ol>
189
-
190
- [Markdown]
191
- - 1. Parent item
192
- - a. Child item A
193
- - b. Child item B
194
- - 2. Another parent
195
-
196
- [HTML]
197
- <ol type="1" class="ol-decimal" data-marker-suffix=".">
198
- <li>Parent item
199
- <ol type="a" class="ol-lower-latin" data-marker-suffix=".">
200
- <li>Child item A</li>
201
- <li>Child item B</li>
202
- </ol>
203
- </li>
204
- <li>Another parent</li>
205
- </ol>
206
- ```
207
-
208
- The plugin also handles loose lists (lists where items are separated by blank lines):
209
-
210
- ```
211
- [Markdown]
212
- - a. First item
213
-
214
- - b. Second item
215
-
216
- [HTML]
217
- <ol type="a" class="ol-lower-latin" data-marker-suffix=".">
218
- <li>
219
- <p>First item</p>
220
- </li>
221
- <li>
222
- <p>Second item</p>
223
- </li>
224
- </ol>
225
-
226
-
227
- [Markdown]
228
- - a. First item first paragraph.
229
-
230
- First item second paragraph.
231
-
232
- - b. Second item first paragraph.
233
-
234
- Second item second paragraph.
235
-
236
- [HTML]
237
- <ol type="a" class="ol-lower-latin" data-marker-suffix=".">
238
- <li>
239
- <p>First item first paragraph.</p>
240
- <p>First item second paragraph.</p>
241
- </li>
242
- <li>
243
- <p>Second item first paragraph.</p>
244
- <p>Second item second paragraph.</p>
245
- </li>
246
- </ol>
247
- ```
248
-
249
- ## Examples: Description Lists
250
-
251
- When description lists are enabled the plugin can convert the following patterns:
252
-
253
- ```
254
- [Markdown]
255
- - **Term 1**
256
- Description text for term 1
257
- - **Term 2**
258
- Description text for term 2
259
-
260
- [HTML]
261
- <dl>
262
- <dt>Term 1</dt>
263
- <dd>
264
- <p>Description text for term 1</p>
265
- </dd>
266
- <dt>Term 2</dt>
267
- <dd>
268
- <p>Description text for term 2</p>
269
- </dd>
270
- </dl>
271
-
272
- [Markdown]
273
- - **Term 1**\
274
- Description text for term 1
275
- - **Term 2**\
276
- Description text for term 2
277
-
278
- [HTML]
279
- <dl>
280
- <dt>Term 1</dt>
281
- <dd>
282
- <p>Description text for term 1</p>
283
- </dd>
284
- <dt>Term 2</dt>
285
- <dd>
286
- <p>Description text for term 2</p>
287
- </dd>
288
- </dl>
289
-
290
- [Markdown]
291
- - **Term 1**
292
-
293
- Description 1, line 1.
294
-
295
- Description 1, line 2.
296
-
297
- - **Term 2**
298
-
299
- Description 2, line 1.
300
-
301
- Description 2, line 2.
302
-
303
- [HTML]
304
- <dl>
305
- <dt>Term 1</dt>
306
- <dd>
307
- <p>Description 1, line 1.</p>
308
- <p>Description 1, line 2.</p>
309
- </dd>
310
- <dt>Term 2</dt>
311
- <dd>
312
- <p>Description 2, line 1.</p>
313
- <p>Description 2, line 2.</p>
314
- </dd>
315
- </dl>
316
- ```
317
-
318
- ## Install
319
-
320
- ```pwsh
321
- npm install @peaceroad/markdown-it-numbering-ul-regarded-as-ol
322
- ```
323
-
324
- ## Basic usage
325
-
326
- ```js
327
- import mdit from 'markdown-it'
328
- import mditNumberingUl from '@peaceroad/markdown-it-numbering-ul-regarded-as-ol'
329
-
330
- const md = new mdit()
331
- md.use(mditNumberingUl)
332
-
333
- const html = md.render(`- a. First\n- b. Second`)
334
- console.log(html)
335
- ```
1
+ # p7d-markdown-it-numbering-ul-regarded-as-ol
2
+
3
+ Markdown's default ordered list markers are limited. This plugin extends Markdown's unordered lists so they can use many kinds of ordered markers.
4
+
5
+ Also, this plugin option provides a description-list conversion. Unordered list items whose first line is wrapped in `**` and followed by two spaces are converted into `<dl>` elements.
6
+
7
+ ## Ordered lists conversion behavior
8
+
9
+ This plugin detects unordered lists that use number-like markers (for example `- a.`, `- ①`) and converts them into appropriate ordered lists (`<ol>`). During conversion the plugin also attaches informative attributes to the generated elements.
10
+
11
+ Code. Conversion of a lowercase Roman numeral list.
12
+
13
+ ```
14
+ [Markdown]
15
+ - i. First item
16
+ - ii. Second item
17
+ - iii. Third item
18
+
19
+ [HTML]
20
+ <ol type="i" class="ol-lower-roman" data-marker-suffix=".">
21
+ <li>First item</li>
22
+ <li>Second item</li>
23
+ <li>Third item</li>
24
+ </ol>
25
+ ```
26
+
27
+ ### Supported Marker Types
28
+
29
+ The plugin supports the following marker types.
30
+
31
+ - **HTML Standard Markers (with `type` attribute)**
32
+ - decimal: `1`, `2`, `3`, pattern: common
33
+ - lower-latin: `a`, `b`, `c`, pattern: common
34
+ - upper-latin: `A`, `B`, `C`, pattern: common
35
+ - lower-roman: `i`, `ii`, `iii`, pattern: common
36
+ - upper-roman: `I`, `II`, `III`, pattern: common
37
+ - **Custom Markers (with `role="list"`)**
38
+ - circled-decimal: `①`, `②`, `③`, pattern: enclosed
39
+ - filled-circled-decimal: `❶`, `❷`, `❸`, pattern: enclosed
40
+ - circled-lower-latin: `ⓐ`, `ⓑ`, `ⓒ`, pattern: enclosed
41
+ - circled-upper-latin: `Ⓐ`, `Ⓑ`, `Ⓒ`, pattern: enclosed
42
+ - filled-circled-upper-latin: `🅐`, `🅑`, `🅒`, pattern: enclosed
43
+ - squared-decimal: `1⃣`, `2⃣`, `3⃣`, pattern: enclosed
44
+ - squared-upper-latin: `🄰`, `🄱`, `🄲`, pattern: enclosed
45
+ - filled-squared-upper-latin: `🅰`, `🅱`, `🅲`, pattern: enclosed
46
+ - fullwidth-lower-roman: `ⅰ`, `ⅱ`, `ⅲ`, pattern: fullwidth
47
+ - fullwidth-upper-roman: `Ⅰ`, `Ⅱ`, `Ⅲ`, pattern: fullwidth
48
+ - japanese-informal: `一`, `二`, `三`, pattern: fullwidth
49
+ - katakana: `ア`, `イ`, `ウ`, pattern: fullwidth
50
+ - katakana-iroha: `イ`, `ロ`, `ハ`, pattern: fullwidth
51
+ - lower-greek: `α`, `β`, `γ`, pattern: common
52
+
53
+ Marker separators differ depending on the character style used for the ordinal marker: ASCII markers (`- a.`, `- a)`, `(a)`), fullwidth markers (`- 一、`, `- 一.`), or enclosed glyphs (`- ①`, `- ❶`). The `pattern` value for each marker type indicates which separator rules apply:
54
+
55
+ - `common`: examples include `a.`, `a)`, `(a)`;
56
+ - `fullwidth`: includes fullwidth separators such as `イ.`, `イ)`, `(イ)`;
57
+ - `enclosed`: enclosed glyphs like `①` which do not use `.` or `)` as separators.
58
+
59
+ After the marker separator, an ASCII space is normally expected. For `fullwidth` and `enclosed` patterns a fullwidth space is accepted in place of the ASCII space; enclosed markers may also appear without a following space. See `listTypes.json` for the canonical marker definitions.
60
+
61
+ ### Attributes and markers
62
+
63
+ - The generated `<ol>` receives a `class` of the form `ol-<marker-name>`. For example, a `- a.` marker results in `class="ol-lower-latin"` on the `<ol>`.
64
+ - Standard HTML markers (decimal, latin, roman) produce an `<ol>` with a `type` attribute (for example `type="1"`, `type="a"`, `type="i"`). Custom markers (circled numbers, Katakana, Kanji, etc.) do not set a `type` attribute by default; instead the plugin emits `role="list"` on the `<ol>`.
65
+ - When the starting number is not `1`, the plugin adds a native `start` attribute to the `<ol>` for both standard and custom markers.
66
+ - When a marker separator is present, the plugin adds `data-marker-prefix` and/or `data-marker-suffix` attributes with the matched strings. These attributes are omitted if there is no prefix/suffix (or if the suffix is visually only whitespace). For example, `- a.` results in `data-marker-suffix="."`.
67
+ - For custom markers the plugin inserts the visible marker text inside a `span` with the configured `markerSpanClass` (default: `li-num`). Example: `- ①` becomes `<li><span class="li-num" aria-hidden="true">①</span> A item.</li>`.
68
+ - When individual list item numbers jump, the plugin sets the native `value` attribute on the `li` element for both standard and custom markers.
69
+
70
+ ### Structures
71
+
72
+ - Marker type detection is deterministic: gather all markers at a nesting level, match them against the canonical definitions, keep the type that explains the most items while preserving numeric continuity, and use the order in `listTypes.json` only as a final tiebreaker.
73
+ - Flattening: A pattern like `- 1.` is represented by the default `ul > li > ol` nesting structure in markdown-it, but this plugin simplifies it to a single `ol` by default to match the representation of other markers.
74
+
75
+ Note: For custom marker lists (those rendered with `role="list"`) the plugin assumes you will hide the native marker via CSS (for example `ol[role="list"] { list-style: none; }`). The `hasListStyleNone` option can be enabled to add `style="list-style: none;"` directly to generated `<ol>` elements.
76
+
77
+ ### Behavior customization
78
+
79
+ You can customize the conversion using options.
80
+
81
+ - `unremoveUlNest` (boolean) — If `true`, preserve the original `ul > li > ol` nesting instead of flattening into `ol > li`.
82
+ - `alwaysMarkerSpan` (boolean) — Wrap markers in a `<span>` (class `markerSpanClass`, default: `li-num`). When markers are rendered as custom markers the plugin emits `role="list"` and does not set a `type` attribute on the `<ol>`.
83
+ - `useCounterStyle` (boolean) — When `true` the plugin suppresses generated marker spans (no `span.li-num`) and prefers native `start`/`value` attributes so you can style lists with CSS `@counter-style`. Note that in this case the marker will not be selectable, as browsers currently do not support CSS `user-select` on markers.
84
+ - `markerSpanClass` (string) — Specify the class name applied to the marker `<span>` (default: `li-num`).
85
+ - `hasListStyleNone` (boolean) — When the plugin emits `role="list"`, also add `style="list-style: none;"` to the `<ol>`.
86
+ - `omitMarkerMetadata` (boolean) — If `true`, omit the `data-marker-prefix` / `data-marker-suffix` attributes.
87
+ - `addMarkerStyleToClass` (boolean) — When `true`, append suffix-style information to the generated class name (e.g. `ol-decimal-with-round-round`). When `false` (default) the class stays as `ol-decimal`.
88
+
89
+ ## Description lists conversion behavior
90
+
91
+ When the `descriptionList` option is enabled the plugin converts specially formatted bullet lists into HTML description lists (`<dl>`).
92
+
93
+ - Each list item must start with a `**Term**` line.
94
+ - If the Term line is not separated from the description by a blank line, then the Term line must end with two ASCII spaces (a Markdown line-break) or a backslash `\` to indicate the description follows.
95
+
96
+ In the conversion the `**Term**` line becomes a `<dt>` and the subsequent lines become the corresponding `<dd>`.
97
+
98
+ Note: Currently the content inside `<dd>` elements is always wrapped in `<p>` elements.
99
+
100
+ ### Description list options
101
+
102
+ - `descriptionList` (boolean) — Enable conversion of `**Term**` list patterns into `<dl>` description lists.
103
+ - `descriptionListWithDiv` (boolean) — Wrap `<dt>/<dd>` pairs in a `<div>` when enabled.
104
+ - `descriptionListDivClass` (string) — Class applied to the wrapper `<div>` when `descriptionListWithDiv` is enabled (empty string disables the class).
105
+
106
+ ## Examples: Ordered Lists
107
+
108
+ HTML standard marker conversion (markers that set the `type` attribute). The plugin also accepts `)` as a separator in place of `.`:
109
+
110
+ ```
111
+ [Markdown]
112
+ - A) First
113
+ - B) Second
114
+ - C) Third
115
+
116
+ [HTML]
117
+ <ol type="A" class="ol-upper-latin" data-marker-suffix=")">
118
+ <li>First</li>
119
+ <li>Second</li>
120
+ <li>Third</li>
121
+ </ol>
122
+ ```
123
+
124
+ Custom marker conversion example:
125
+
126
+ ```
127
+ [Markdown]
128
+ - First
129
+ - Second
130
+ - ③ Third
131
+
132
+ [HTML]
133
+ <ol role="list" class="ol-filled-circled-decimal">
134
+ <li><span class="li-num" aria-hidden="true">①</span> First</li>
135
+ <li><span class="li-num" aria-hidden="true">②</span> Second</li>
136
+ <li><span class="li-num" aria-hidden="true">③</span> Third</li>
137
+ </ol>
138
+ <!-- In this case the stylesheet is expected to hide the native marker, e.g. ol[role="list"] { list-style: none; } -->
139
+ ```
140
+
141
+ Standard numeric markdown is converted as usual:
142
+
143
+ ```
144
+ [Markdown]
145
+ 1. First item
146
+ 2. Second item
147
+
148
+ [HTML]
149
+ <ol type="1" class="ol-decimal" data-marker-suffix=".">
150
+ <li>First item</li>
151
+ <li>Second item</li>
152
+ </ol>
153
+ ```
154
+
155
+ For lists written in the `- 1.` style this plugin flattens the default `ul > li > ol` nesting into a single `ol > li` structure to match other conversion patterns:
156
+
157
+ ```
158
+ [Markdown]
159
+ - 1. First item
160
+ - 2. Second item
161
+ - 3. Third item
162
+
163
+ [HTML]
164
+ <ol type="1" class="ol-decimal" data-marker-suffix=".">
165
+ <li>First item</li>
166
+ <li>Second item</li>
167
+ <li>Third item</li>
168
+ </ol>
169
+ ```
170
+
171
+ Nested lists are supported as well:
172
+
173
+ ```
174
+ [Markdown]
175
+ - First item
176
+ - i. Subitem A
177
+ - iii. Subitem C
178
+ - ④ Second item
179
+
180
+ [HTML]
181
+ <ol role="list" start="2" class="ol-circled-decimal">
182
+ <li><span class="li-num" aria-hidden="true">②</span> First item
183
+ <ol type="i" class="ol-lower-roman" data-marker-suffix=".">
184
+ <li>Subitem A</li>
185
+ <li value="3">Subitem C</li>
186
+ </ol>
187
+ </li>
188
+ <li value="4"><span class="li-num" aria-hidden="true">④</span> Second item</li>
189
+ </ol>
190
+
191
+ [Markdown]
192
+ - 1. Parent item
193
+ - a. Child item A
194
+ - b. Child item B
195
+ - 2. Another parent
196
+
197
+ [HTML]
198
+ <ol type="1" class="ol-decimal" data-marker-suffix=".">
199
+ <li>Parent item
200
+ <ol type="a" class="ol-lower-latin" data-marker-suffix=".">
201
+ <li>Child item A</li>
202
+ <li>Child item B</li>
203
+ </ol>
204
+ </li>
205
+ <li>Another parent</li>
206
+ </ol>
207
+ ```
208
+
209
+ The plugin also handles loose lists (lists where items are separated by blank lines):
210
+
211
+ ```
212
+ [Markdown]
213
+ - a. First item
214
+
215
+ - b. Second item
216
+
217
+ [HTML]
218
+ <ol type="a" class="ol-lower-latin" data-marker-suffix=".">
219
+ <li>
220
+ <p>First item</p>
221
+ </li>
222
+ <li>
223
+ <p>Second item</p>
224
+ </li>
225
+ </ol>
226
+
227
+
228
+ [Markdown]
229
+ - a. First item first paragraph.
230
+
231
+ First item second paragraph.
232
+
233
+ - b. Second item first paragraph.
234
+
235
+ Second item second paragraph.
236
+
237
+ [HTML]
238
+ <ol type="a" class="ol-lower-latin" data-marker-suffix=".">
239
+ <li>
240
+ <p>First item first paragraph.</p>
241
+ <p>First item second paragraph.</p>
242
+ </li>
243
+ <li>
244
+ <p>Second item first paragraph.</p>
245
+ <p>Second item second paragraph.</p>
246
+ </li>
247
+ </ol>
248
+ ```
249
+
250
+ ## Examples: Description Lists
251
+
252
+ When description lists are enabled the plugin can convert the following patterns:
253
+
254
+ ```
255
+ [Markdown]
256
+ - **Term 1**
257
+ Description text for term 1
258
+ - **Term 2**
259
+ Description text for term 2
260
+
261
+ [HTML]
262
+ <dl>
263
+ <dt>Term 1</dt>
264
+ <dd>
265
+ <p>Description text for term 1</p>
266
+ </dd>
267
+ <dt>Term 2</dt>
268
+ <dd>
269
+ <p>Description text for term 2</p>
270
+ </dd>
271
+ </dl>
272
+
273
+ [Markdown]
274
+ - **Term 1**\
275
+ Description text for term 1
276
+ - **Term 2**\
277
+ Description text for term 2
278
+
279
+ [HTML]
280
+ <dl>
281
+ <dt>Term 1</dt>
282
+ <dd>
283
+ <p>Description text for term 1</p>
284
+ </dd>
285
+ <dt>Term 2</dt>
286
+ <dd>
287
+ <p>Description text for term 2</p>
288
+ </dd>
289
+ </dl>
290
+
291
+ [Markdown]
292
+ - **Term 1**
293
+
294
+ Description 1, line 1.
295
+
296
+ Description 1, line 2.
297
+
298
+ - **Term 2**
299
+
300
+ Description 2, line 1.
301
+
302
+ Description 2, line 2.
303
+
304
+ [HTML]
305
+ <dl>
306
+ <dt>Term 1</dt>
307
+ <dd>
308
+ <p>Description 1, line 1.</p>
309
+ <p>Description 1, line 2.</p>
310
+ </dd>
311
+ <dt>Term 2</dt>
312
+ <dd>
313
+ <p>Description 2, line 1.</p>
314
+ <p>Description 2, line 2.</p>
315
+ </dd>
316
+ </dl>
317
+ ```
318
+
319
+ ## Install
320
+
321
+ ```pwsh
322
+ npm install @peaceroad/markdown-it-numbering-ul-regarded-as-ol
323
+ ```
324
+
325
+ ## Basic usage
326
+
327
+ ```js
328
+ import mdit from 'markdown-it'
329
+ import mditNumberingUl from '@peaceroad/markdown-it-numbering-ul-regarded-as-ol'
330
+
331
+ const md = new mdit()
332
+ md.use(mditNumberingUl)
333
+
334
+ const html = md.render(`- a. First\n- b. Second`)
335
+ console.log(html)
336
+ ```