@peaceroad/markdown-it-strong-ja 0.4.1 → 0.4.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.
@@ -1,219 +0,0 @@
1
- [Markdown]
2
- HTMLは「**HyperText Markup Language**」の略です。
3
- [HTML]
4
- <p>HTMLは「<strong>HyperText Markup Language</strong>」の略です。</p>
5
-
6
-
7
- [Markdown]
8
- HTMLは**「HyperText Markup Language」**の略です。
9
- [HTML]
10
- <p>HTMLは<strong>「HyperText Markup Language」</strong>の略です。</p>
11
-
12
-
13
- [Markdown]
14
- HTMLは**「HyperText *Markup* Language」**の略です。
15
- [HTML]
16
- <p>HTMLは<strong>「HyperText <em>Markup</em> Language」</strong>の略です。</p>
17
-
18
-
19
- [Markdown]
20
- HTMLは**「HyperText *Markup* `Language`」**の略です。
21
- [HTML]
22
- <p>HTMLは<strong>「HyperText <em>Markup</em> <code>Language</code>」</strong>の略です。</p>
23
-
24
- [Markdown: 5]
25
- HTMLは**「HyperText Mark
26
-
27
- up Language」**の略です。
28
- [HTML]
29
- <p>HTMLは**「HyperText Mark</p>
30
- <p>up Language」**の略です。</p>
31
-
32
-
33
- [Markdown]
34
- HTMLは\**「HyperText Markup Language」**の略です。
35
- [HTML]
36
- <p>HTMLは**「HyperText Markup Language」**の略です。</p>
37
-
38
-
39
- [Markdown]
40
- HTMLは\\**「HyperText Markup Language」**の略です。
41
- [HTML]
42
- <p>HTMLは\<strong>「HyperText Markup Language」</strong>の略です。</p>
43
-
44
-
45
- [Markdown]
46
- HTMLは\\\**「HyperText Markup Language」**の略です。
47
- [HTML]
48
- <p>HTMLは\**「HyperText Markup Language」**の略です。</p>
49
-
50
- [Markdown]
51
- HTMLは\\\\**「HyperText Markup Language」**の略です。
52
- [HTML]
53
- <p>HTMLは\\<strong>「HyperText Markup Language」</strong>の略です。</p>
54
-
55
-
56
- [Markdown]
57
- HTMLは`**`は**「HyperText Markup Language」**の略です。
58
- [HTML]
59
- <p>HTMLは<code>**</code>は<strong>「HyperText Markup Language」</strong>の略です。</p>
60
-
61
- [Markdown]
62
- HTMLは`**`は**「HyperText** <b>Markup</b> Language」の略です。
63
- [HTML:false]
64
- <p>HTMLは<code>**</code>は<strong>「HyperText</strong> &lt;b&gt;Markup&lt;/b&gt; Language」の略です。</p>
65
- [HTML:true]
66
- <p>HTMLは<code>**</code>は<strong>「HyperText</strong> <b>Markup</b> Language」の略です。</p>
67
-
68
-
69
- [Markdown]
70
- HTMLは`**`は**「HyperText <b>Markup</b> Language」**の略です。
71
- [HTML:false]
72
- <p>HTMLは<code>**</code>は<strong>「HyperText &lt;b&gt;Markup&lt;/b&gt; Language」</strong>の略です。</p>
73
- [HTML:true]
74
- <p>HTMLは<code>**</code>は<strong>「HyperText <b>Markup</b> Language」</strong>の略です。</p>
75
-
76
-
77
- [Markdown]
78
- ```
79
- HTMLは`**`は**「HyperText Markup Language」**の略です。
80
- ```
81
- [HTML:false]
82
- <pre><code>HTMLは`**`は**「HyperText Markup Language」**の略です。
83
- </code></pre>
84
- [HTML:true]
85
- <pre><code>HTMLは`**`は**「HyperText Markup Language」**の略です。
86
- </code></pre>
87
-
88
-
89
- [Markdown]
90
- HTMLは**「HyperText <b>Markup</b> Language」**
91
- [HTML:false]
92
- <p>HTMLは<strong>「HyperText &lt;b&gt;Markup&lt;/b&gt; Language」</strong></p>
93
- [HTML:true]
94
- <p>HTMLは<strong>「HyperText <b>Markup</b> Language」</strong></p>
95
-
96
-
97
- [Markdown]
98
- HTMLは「**HyperText Markup Language**」
99
- [HTML]
100
- <p>HTMLは「<strong>HyperText Markup Language</strong>」</p>
101
-
102
- [Markdown]
103
- HTMLは**「HyperText Markup Language」**。
104
- [HTML]
105
- <p>HTMLは<strong>「HyperText Markup Language」</strong>。</p>
106
-
107
- [Markdown]
108
- HTMLは**「HyperText Markup Language」**
109
- [HTML]
110
- <p>HTMLは<strong>「HyperText Markup Language」</strong></p>
111
-
112
-
113
- [Markdown]
114
- HTMLは**「HyperText Markup Language」**。
115
- [HTML]
116
- <p>HTMLは<strong>「HyperText Markup Language」</strong>。</p>
117
-
118
- [Markdown]
119
- ****
120
- [HTML]
121
- <hr>
122
-
123
- [Markdown]
124
- a****b
125
- [HTML]
126
- <p>a****b</p>
127
-
128
- [Markdown]
129
- a****
130
- [HTML]
131
- <p>a****</p>
132
-
133
-
134
- [Markdown]
135
- HTMLは**「HyperText <b>Markup</b> Language」**
136
-
137
- HTMLは**「HyperText <b>Markup</b> Language」**
138
- [HTML:false]
139
- <p>HTMLは<strong>「HyperText &lt;b&gt;Markup&lt;/b&gt; Language」</strong></p>
140
- <p>HTMLは<strong>「HyperText &lt;b&gt;Markup&lt;/b&gt; Language」</strong></p>
141
- [HTML:true]
142
- <p>HTMLは<strong>「HyperText <b>Markup</b> Language」</strong></p>
143
- <p>HTMLは<strong>「HyperText <b>Markup</b> Language」</strong></p>
144
-
145
- [Markdown]
146
- HTMLは**「Hyper[Text] Markup Language」**
147
- [HTML]
148
- <p>HTMLは<strong>「Hyper[Text] Markup Language」</strong></p>
149
-
150
- [Markdown]
151
- HTMLは**「Hyper[Text] <b>Markup</b> Language」**
152
- [HTML:false]
153
- <p>HTMLは<strong>「Hyper[Text] &lt;b&gt;Markup&lt;/b&gt; Language」</strong></p>
154
- [HTML:true]
155
- <p>HTMLは<strong>「Hyper[Text] <b>Markup</b> Language」</strong></p>
156
-
157
-
158
- [Markdown]
159
- HTMLは**「Hyper[Text] Markup Language」**
160
- [HTML]
161
- <p>HTMLは<strong>「Hyper[Text] Markup Language」</strong></p>
162
-
163
- [Markdown]
164
- HTMLは**「Hyper[Text] <b>Markup</b> Language」**
165
- [HTML:false]
166
- <p>HTMLは<strong>「Hyper[Text] &lt;b&gt;Markup&lt;/b&gt; Language」</strong></p>
167
- [HTML:true]
168
- <p>HTMLは<strong>「Hyper[Text] <b>Markup</b> Language」</strong></p>
169
-
170
-
171
- [Markdown]
172
- - HTMLは**「Hyper[Text] Markup Language」**
173
- [HTML]
174
- <ul>
175
- <li>HTMLは<strong>「Hyper[Text] Markup Language」</strong></li>
176
- </ul>
177
-
178
-
179
- [Markdown]
180
- HTMLは**「Hyper[Text](https://example.com/) Markup Language」**
181
- [HTML]
182
- <p>HTMLは<strong>「Hyper<a href="https://example.com/">Text</a> Markup Language」</strong></p>
183
-
184
- [Markdown]
185
- HTMLは[**HyperText Markup Language**](https://example.com/)
186
- [HTML]
187
- <p>HTMLは<a href="https://example.com/"><strong>HyperText Markup Language</strong></a></p>
188
-
189
- [Markdown]
190
- HTMLは[**「HyperText Markup Language」**](https://example.com/)
191
- [HTML]
192
- <p>HTMLは<a href="https://example.com/"><strong>「HyperText Markup Language」</strong></a></p>
193
-
194
- [Markdown]
195
- HTMLは[**「HyperText Markup Language」**][]です。
196
-
197
- [**「HyperText Markup Language」**]: https://example.com/
198
- [HTML]
199
- <p>HTMLは<a href="https://example.com/"><strong>「HyperText Markup Language」</strong></a>です。</p>
200
-
201
- [Markdown]
202
- - HTMLは**「Hyper[Text](https://example.com/) Markup Language」**
203
- [HTML]
204
- <ul>
205
- <li>HTMLは<strong>「Hyper<a href="https://example.com/">Text</a> Markup Language」</strong></li>
206
- </ul>
207
-
208
- [Markdown]
209
- aaa><aaa
210
- [HTML]
211
- <p>aaa&gt;&lt;aaa</p>
212
-
213
-
214
- [Markdown]
215
- aaa&lt;/&gt;aaa
216
- [HTML]
217
- <p>aaa&lt;/&gt;aaa</p>
218
-
219
-
@@ -1,289 +0,0 @@
1
- [Markdown]
2
- - a
3
- - b
4
- {.nomarker}
5
- [HTML]
6
- <ul>
7
- <li>a</li>
8
- <li>b
9
- {.nomarker}</li>
10
- </ul>
11
-
12
- [Markdown]
13
- - **あ**
14
- - **い
15
- {.nomarker}
16
- [HTML]
17
- <ul>
18
- <li><strong>あ</strong></li>
19
- <li>**い
20
- {.nomarker}</li>
21
- </ul>
22
-
23
- [Markdown]
24
- - *aあ
25
- {.style}
26
- [HTML:false]
27
- <ul>
28
- <li>*aあ
29
- {.style}</li>
30
- </ul>
31
-
32
- [Markdown]
33
- - **あい**:aaaあ
34
- {.style}
35
- [HTML]
36
- <ul>
37
- <li><strong>あい</strong>:aaaあ
38
- {.style}</li>
39
- </ul>
40
-
41
- [Markdown]
42
- - **a**: a1
43
- - **b**: b1
44
- {.nomarker}
45
- [HTML]
46
- <ul>
47
- <li><strong>a</strong>: a1</li>
48
- <li><strong>b</strong>: b1
49
- {.nomarker}</li>
50
- </ul>
51
-
52
- [Markdown]
53
- - **a**: a1
54
- - **b**: びーいち
55
- {.nomarker}
56
- [HTML]
57
- <ul>
58
- <li><strong>a</strong>: a1</li>
59
- <li><strong>b</strong>: びーいち
60
- {.nomarker}</li>
61
- </ul>
62
- [HTML:true]
63
- <ul>
64
- <li><strong>a</strong>: a1</li>
65
- <li><strong>b</strong>: びーいち
66
- {.nomarker}</li>
67
- </ul>
68
-
69
- [Markdown]
70
- - *aあ {.li-style}
71
- {.ul-style}
72
- [HTML:false]
73
- <ul>
74
- <li>*aあ {.li-style}
75
- {.ul-style}</li>
76
- </ul>
77
-
78
- [Markdown]
79
- - *aあ {.li-style}
80
- {.ul-style} aa
81
- [HTML:false]
82
- <ul>
83
- <li>*aあ {.li-style}
84
- {.ul-style} aa</li>
85
- </ul>
86
-
87
- [Markdown]
88
- - *aあ {.li-style}
89
- \{.ul-style} aa {.next-li-style}
90
- [HTML:false]
91
- <ul>
92
- <li>*aあ {.li-style}
93
- {.ul-style} aa {.next-li-style}</li>
94
- </ul>
95
- [HTML:true]
96
- <ul>
97
- <li>*aあ {.li-style}
98
- {.ul-style} aa {.next-li-style}</li>
99
- </ul>
100
-
101
- [Markdown]
102
- - *aあ {.li-style}い
103
- \{.ul-style} aa {.next-li-style}
104
- [HTML:false]
105
- <ul>
106
- <li>*aあ {.li-style}い
107
- {.ul-style} aa {.next-li-style}</li>
108
- </ul>
109
-
110
- [Markdown]
111
- - *bい {.li-style}
112
- \\{.ul-style} bb {.next-li-style}
113
- [HTML:false]
114
- <ul>
115
- <li>*bい {.li-style}
116
- \{.ul-style} bb {.next-li-style}</li>
117
- </ul>
118
-
119
- [Markdown]
120
- - *う {.li-style}
121
- {.ul-style} b*b {}
122
- [HTML:false]
123
- <ul>
124
- <li><em>う {.li-style}
125
- {.ul-style} b</em>b {}</li>
126
- </ul>
127
-
128
- [Markdown]
129
- - *う* {.li-style}
130
- {.ul-style} u }
131
- [HTML:false]
132
- <ul>
133
- <li><em>う</em> {.li-style}
134
- {.ul-style} u }</li>
135
- </ul>
136
-
137
- [Markdown]
138
- *う* {.li-style}
139
- {.ul-style} u }
140
- [HTML:false]
141
- <p><em>う</em> {.li-style}
142
- {.ul-style} u }</p>
143
-
144
- [Markdown]
145
- *う {.li-style}
146
- {.ul-style} u }
147
- [HTML:false]
148
- <p>*う {.li-style}
149
- {.ul-style} u }</p>
150
-
151
- [Markdown]
152
- *{.s}*
153
- [HTML:false]
154
- <p><em>{.s}</em></p>
155
-
156
- [Markdown]
157
- a
158
- *{.s}*
159
- [HTML:false]
160
- <p>a
161
- <em>{.s}</em></p>
162
-
163
- [Markdown]
164
- a
165
- *b{.s}*
166
- [HTML:false]
167
- <p>a
168
- <em>b{.s}</em></p>
169
-
170
- [Markdown]
171
- - e {.li-style}
172
- *{.ul-style}*
173
- [HTML:false]
174
- <ul>
175
- <li>e {.li-style}
176
- <em>{.ul-style}</em></li>
177
- </ul>
178
-
179
-
180
- [Markdown]
181
- **\{}**
182
- [HTML]
183
- <p><strong>{}</strong></p>
184
-
185
- [Markdown]
186
- **\{a}**
187
- [HTML]
188
- <p><strong>{a}</strong></p>
189
-
190
- [Markdown]
191
- **\\{a}**
192
- [HTML]
193
- <p><strong>\{a}</strong></p>
194
-
195
- [Markdown]
196
- **\\\{a}**
197
- [HTML]
198
- <p><strong>\{a}</strong></p>
199
-
200
- [Markdown]
201
- **\\\\{a}**
202
- [HTML]
203
- <p><strong>\\{a}</strong></p>
204
-
205
-
206
- [Markdown]
207
- **\a\{a}**
208
- [HTML]
209
- <p><strong>\a{a}</strong></p>
210
-
211
- [Markdown]
212
- *<span>a</span>b{.style}*
213
- [HTML:false]
214
- <p><em>&lt;span&gt;a&lt;/span&gt;b{.style}</em></p>
215
- [HTML:true]
216
- <p><em><span>a</span>b{.style}</em></p>
217
-
218
- [Markdown]
219
- *<span>ab{.style}*
220
- [HTML:false]
221
- <p><em>&lt;span&gt;ab{.style}</em></p>
222
- [HTML:true]
223
- <p><em><span>ab{.style}</em></p>
224
-
225
- [Markdown]
226
- *b{.style}**
227
- [HTML]
228
- <p><em>b{.style}</em>*</p>
229
-
230
- [Markdown]
231
- **う {.li-style}
232
- {.ul-style} u }
233
- [HTML:false]
234
- <p>**う {.li-style}
235
- {.ul-style} u }</p>
236
-
237
- [Markdown]
238
- **{.s}**
239
- [HTML:false]
240
- <p><strong>{.s}</strong></p>
241
-
242
- [Markdown]
243
- a
244
- **{.s}**
245
- [HTML:false]
246
- <p>a
247
- <strong>{.s}</strong></p>
248
-
249
- [Markdown]
250
- a
251
- **b{.s}**
252
- [HTML:false]
253
- <p>a
254
- <strong>b{.s}</strong></p>
255
-
256
- [Markdown]
257
- - e {.li-style}
258
- **{.ul-style}***
259
- [HTML:false]
260
- <ul>
261
- <li>e {.li-style}
262
- <strong>{.ul-style}</strong>*</li>
263
- </ul>
264
-
265
- [Markdown]
266
- **<span>a</span>b{.style}**
267
- [HTML:false]
268
- <p><strong>&lt;span&gt;a&lt;/span&gt;b{.style}</strong></p>
269
- [HTML:true]
270
- <p><strong><span>a</span>b{.style}</strong></p>
271
-
272
- [Markdown]
273
- **<span>ab{.style}**
274
- [HTML:false]
275
- <p><strong>&lt;span&gt;ab{.style}</strong></p>
276
- [HTML:true]
277
- <p><strong><span>ab{.style}</strong></p>
278
-
279
- [Markdown]
280
- **b{.style}***
281
- [HTML]
282
- <p><strong>b{.style}</strong>*</p>
283
-
284
- [Markdown]
285
- *a
286
- {.s}*
287
- [HTML]
288
- <p><em>a
289
- {.s}</em></p>
package/test/test.js DELETED
@@ -1,109 +0,0 @@
1
- import assert from 'assert'
2
- import fs from 'fs'
3
- import path from 'path'
4
- import url from 'url'
5
-
6
- import mdit from 'markdown-it'
7
- import mditAttrs from 'markdown-it-attrs'
8
- import mditCJKBreaks from '@sup39/markdown-it-cjk-breaks'
9
- import mditStrongJa from '../index.js'
10
-
11
- const __dirname = path.dirname(url.fileURLToPath(import.meta.url)).replace(/\\/g, '/')
12
-
13
- const md = mdit().use(mditStrongJa).use(mditAttrs)
14
- const mdWithHtml = mdit({html: true}).use(mditStrongJa).use(mditAttrs)
15
- const mdWithCJKBreaks = mdit().use(mditStrongJa).use(mditAttrs).use(mditCJKBreaks, {either: true})
16
- const mdWithCJKBreaksWithHtml = mdit({html: true}).use(mditStrongJa).use(mditAttrs).use(mditCJKBreaks, {either: true})
17
-
18
- const mditNoAttrs = mdit().use(mditStrongJa, {mditAttrs: false})
19
- const mditNoAttrsWithHtml = mdit({html: true}).use(mditStrongJa, {mditAttrs: false})
20
- const mditNoAttrsCJKBreaks = mdit().use(mditStrongJa, {mditAttrs: false}).use(mditCJKBreaks, {either: true})
21
- const mditNoAttrsCJKBreaksWithHtml = mdit({html: true}).use(mditStrongJa, {mditAttrs: false}).use(mditCJKBreaks, {either: true})
22
-
23
- const check = (ms, example, allPass, useAttrs) => {
24
- let n = 1
25
- while (n < ms.length) {
26
- //if (n !== 81) { n++; continue }
27
- const m = ms[n].markdown
28
- let h = ''
29
- if (example === 'withLineBreak') {
30
- h = useAttrs ? mdWithCJKBreaks.render(m) : mditNoAttrsCJKBreaks.render(m)
31
- } else {
32
- h = useAttrs ? md.render(m) : mditNoAttrs.render(m)
33
- }
34
- try {
35
- assert.strictEqual(h, ms[n].html)
36
- } catch(e) {
37
- console.log('Test [' + n + ', HTML: false, useAttrs: ' + useAttrs + '] >>>')
38
- console.log('Input: ' + ms[n].markdown + '\nOutput: ' + h + 'Correct: ' + ms[n].html)
39
- allPass = false
40
- }
41
- if (ms[n].htmlWithHtmlTrue) {
42
- let hh = ''
43
- if (example === 'withLineBreak') {
44
- hh = useAttrs ? mdWithCJKBreaksWithHtml.render(m) : mditNoAttrsCJKBreaksWithHtml.render(m)
45
- } else {
46
- hh = useAttrs ? mdWithHtml.render(m) : mditNoAttrsWithHtml.render(m)
47
- }
48
- try {
49
- assert.strictEqual(hh, ms[n].htmlWithHtmlTrue)
50
- } catch(e) {
51
- console.log('Test [' + n + ', HTML: true, useAttrs: ' + useAttrs + '] >>>')
52
- console.log('Input: ' + ms[n].markdown + '\nOutput: ' + hh + 'Correct: ' + ms[n].htmlWithHtmlTrue)
53
- allPass = false
54
- }
55
- }
56
- n++
57
- }
58
- return allPass
59
- }
60
-
61
- const examples = {
62
- strong: __dirname + '/example-strong.txt',
63
- em: __dirname + '/example-em.txt',
64
- complex: __dirname + '/example-complex.txt',
65
- withLineBreak: __dirname + '/example-with-linebreak.txt',
66
- }
67
-
68
- const examplesMditNoAttrs = {
69
- strong: __dirname + '/mditNoAttrs/example-strong.txt',
70
- em: __dirname + '/mditNoAttrs/example-em.txt',
71
- complex: __dirname + '/mditNoAttrs/example-complex.txt',
72
- withLineBreak: __dirname + '/mditNoAttrs/example-with-linebreak.txt',
73
- }
74
-
75
- const runTests = (examples, useAttrs) => {
76
- let allPass = true
77
- for (let example in examples) {
78
- const exampleCont = fs.readFileSync(examples[example], 'utf-8').trim()
79
- let ms = [];
80
- let ms0 = exampleCont.split(/(?:^|\n+)\[Markdown[^\]]*?\]\n/)
81
- let n = 1
82
- while (n < ms0.length) {
83
- let mhs = ms0[n].split(/\n+\[HTML[^\]]*?\]\n/)
84
- let i = 1
85
- while (i < 3) {
86
- if (mhs[i] === undefined) {
87
- mhs[i] = ''
88
- } else {
89
- mhs[i] = mhs[i].replace(/$/,'\n')
90
- }
91
- i++
92
- }
93
- ms[n] = {
94
- markdown: mhs[0],
95
- html: mhs[1],
96
- htmlWithHtmlTrue: mhs[2],
97
- }
98
- n++
99
- }
100
- console.log('Check ' + example + ' process [mditAttrs: ' + useAttrs + '] =======================')
101
- allPass = check(ms, example, allPass, useAttrs)
102
- }
103
- return allPass
104
- }
105
-
106
- let allPass = runTests(examples, true)
107
- allPass = runTests(examplesMditNoAttrs, false) && allPass
108
-
109
- if (allPass) console.log('Passed all tests.')