securemark 0.265.0 → 0.267.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +1 -1
  3. package/dist/index.js +49 -42
  4. package/index.d.ts +7 -7
  5. package/markdown.d.ts +4 -4
  6. package/package.json +1 -1
  7. package/src/parser/api/bind.test.ts +17 -17
  8. package/src/parser/api/bind.ts +1 -0
  9. package/src/parser/api/parse.test.ts +6 -8
  10. package/src/parser/api/parse.ts +2 -1
  11. package/src/parser/block/dlist.test.ts +34 -34
  12. package/src/parser/block/extension/aside.test.ts +3 -3
  13. package/src/parser/block/extension/aside.ts +2 -2
  14. package/src/parser/block/extension/figure.test.ts +2 -2
  15. package/src/parser/block/heading.test.ts +47 -47
  16. package/src/parser/block/olist.test.ts +29 -29
  17. package/src/parser/block/pagebreak.test.ts +31 -0
  18. package/src/parser/block/pagebreak.ts +7 -0
  19. package/src/parser/block/reply/cite.test.ts +1 -1
  20. package/src/parser/block/ulist.test.ts +25 -25
  21. package/src/parser/block.ts +3 -3
  22. package/src/parser/inline/autolink/account.ts +3 -5
  23. package/src/parser/inline/autolink/anchor.test.ts +2 -2
  24. package/src/parser/inline/autolink/anchor.ts +4 -3
  25. package/src/parser/inline/autolink/channel.test.ts +0 -2
  26. package/src/parser/inline/autolink/channel.ts +0 -1
  27. package/src/parser/inline/autolink/hashnum.test.ts +1 -1
  28. package/src/parser/inline/autolink/hashtag.test.ts +2 -6
  29. package/src/parser/inline/autolink/hashtag.ts +7 -20
  30. package/src/parser/inline/extension/index.test.ts +48 -48
  31. package/src/parser/inline/extension/index.ts +1 -1
  32. package/src/parser/inline/extension/indexee.ts +15 -11
  33. package/src/parser/inline/extension/indexer.ts +1 -1
  34. package/src/parser/inline/link.ts +1 -0
  35. package/src/parser/inline/mark.test.ts +9 -9
  36. package/src/parser/inline/mark.ts +1 -1
  37. package/src/parser/inline.test.ts +9 -6
  38. package/src/parser/processor/figure.test.ts +19 -19
  39. package/src/parser/processor/footnote.test.ts +66 -66
  40. package/src/parser/processor/footnote.ts +11 -11
  41. package/src/util/toc.test.ts +28 -28
  42. package/src/parser/block/horizontalrule.test.ts +0 -31
  43. package/src/parser/block/horizontalrule.ts +0 -7
@@ -27,18 +27,18 @@ describe('Unit: parser/processor/footnote', () => {
27
27
  [...target.children].map(el => el.outerHTML),
28
28
  [
29
29
  html('p', [
30
- html('sup', { class: "annotation", id: "annotation:ref:1", title: "a b" }, [
30
+ html('sup', { class: "annotation", id: "annotation::ref:1", title: "a b" }, [
31
31
  html('span', { hidden: '' }, 'a b'),
32
- html('a', { href: "#annotation:def:1" }, '*1')
32
+ html('a', { href: "#annotation::def:1" }, '*1')
33
33
  ]),
34
34
  ]).outerHTML,
35
35
  ]);
36
36
  assert.deepStrictEqual(
37
37
  footnote.outerHTML,
38
38
  html('ol', [
39
- html('li', { id: 'annotation:def:1' }, [
39
+ html('li', { id: 'annotation::def:1' }, [
40
40
  'a b',
41
- html('sup', [html('a', { href: '#annotation:ref:1' }, '^1')])
41
+ html('sup', [html('a', { href: '#annotation::ref:1' }, '^1')])
42
42
  ]),
43
43
  ]).outerHTML);
44
44
  }
@@ -53,26 +53,26 @@ describe('Unit: parser/processor/footnote', () => {
53
53
  [...target.children].map(el => el.outerHTML),
54
54
  [
55
55
  html('p', [
56
- html('sup', { class: "annotation", id: "annotation:ref:1", title: "1" }, [
56
+ html('sup', { class: "annotation", id: "annotation::ref:1", title: "1" }, [
57
57
  html('span', { hidden: '' }, '1'),
58
- html('a', { href: "#annotation:def:1" }, '*1')
58
+ html('a', { href: "#annotation::def:1" }, '*1')
59
59
  ]),
60
- html('sup', { class: "annotation", id: "annotation:ref:2", title: "12345678901234567890" }, [
60
+ html('sup', { class: "annotation", id: "annotation::ref:2", title: "12345678901234567890" }, [
61
61
  html('span', { hidden: '' }, '12345678901234567890'),
62
- html('a', { href: "#annotation:def:2" }, '*2')
62
+ html('a', { href: "#annotation::def:2" }, '*2')
63
63
  ]),
64
64
  ]).outerHTML,
65
65
  ]);
66
66
  assert.deepStrictEqual(
67
67
  footnote.outerHTML,
68
68
  html('ol', [
69
- html('li', { id: 'annotation:def:1' }, [
69
+ html('li', { id: 'annotation::def:1' }, [
70
70
  '1',
71
- html('sup', [html('a', { href: '#annotation:ref:1' }, '^1')])
71
+ html('sup', [html('a', { href: '#annotation::ref:1' }, '^1')])
72
72
  ]),
73
- html('li', { id: 'annotation:def:2' }, [
73
+ html('li', { id: 'annotation::def:2' }, [
74
74
  '12345678901234567890',
75
- html('sup', [html('a', { href: '#annotation:ref:2' }, '^2')])
75
+ html('sup', [html('a', { href: '#annotation::ref:2' }, '^2')])
76
76
  ]),
77
77
  ]).outerHTML);
78
78
  }
@@ -87,49 +87,49 @@ describe('Unit: parser/processor/footnote', () => {
87
87
  [...target.children].map(el => el.outerHTML),
88
88
  [
89
89
  html('p', [
90
- html('sup', { class: "annotation", id: "annotation:ref:1", title: "1" }, [
90
+ html('sup', { class: "annotation", id: "annotation::ref:1", title: "1" }, [
91
91
  html('span', { hidden: '' }, '1'),
92
- html('a', { href: "#annotation:def:1" }, '*1')
92
+ html('a', { href: "#annotation::def:1" }, '*1')
93
93
  ]),
94
- html('sup', { class: "annotation", id: "annotation:ref:2", title: "2" }, [
94
+ html('sup', { class: "annotation", id: "annotation::ref:2", title: "2" }, [
95
95
  html('span', { hidden: '' }, '2'),
96
- html('a', { href: "#annotation:def:2" }, '*2')
96
+ html('a', { href: "#annotation::def:2" }, '*2')
97
97
  ]),
98
- html('sup', { class: "annotation", id: "annotation:ref:3", title: "3" }, [
98
+ html('sup', { class: "annotation", id: "annotation::ref:3", title: "3" }, [
99
99
  html('span', { hidden: '' }, '3'),
100
- html('a', { href: "#annotation:def:3" }, '*3')
100
+ html('a', { href: "#annotation::def:3" }, '*3')
101
101
  ]),
102
- html('sup', { class: "annotation", id: "annotation:ref:4", title: "2" }, [
102
+ html('sup', { class: "annotation", id: "annotation::ref:4", title: "2" }, [
103
103
  html('span', { hidden: '' }, '2'),
104
- html('a', { href: "#annotation:def:2" }, '*2')
104
+ html('a', { href: "#annotation::def:2" }, '*2')
105
105
  ]),
106
- html('sup', { class: "annotation", id: "annotation:ref:5", title: "4" }, [
106
+ html('sup', { class: "annotation", id: "annotation::ref:5", title: "4" }, [
107
107
  html('span', { hidden: '' }, '4'),
108
- html('a', { href: "#annotation:def:4" }, '*4')
108
+ html('a', { href: "#annotation::def:4" }, '*4')
109
109
  ]),
110
110
  ]).outerHTML,
111
111
  ]);
112
112
  assert.deepStrictEqual(
113
113
  footnote.outerHTML,
114
114
  html('ol', [
115
- html('li', { id: 'annotation:def:1' }, [
115
+ html('li', { id: 'annotation::def:1' }, [
116
116
  '1',
117
- html('sup', [html('a', { href: '#annotation:ref:1' }, '^1')])
117
+ html('sup', [html('a', { href: '#annotation::ref:1' }, '^1')])
118
118
  ]),
119
- html('li', { id: 'annotation:def:2' }, [
119
+ html('li', { id: 'annotation::def:2' }, [
120
120
  '2',
121
121
  html('sup', [
122
- html('a', { href: '#annotation:ref:2' }, '^2'),
123
- html('a', { href: '#annotation:ref:4' }, '^4'),
122
+ html('a', { href: '#annotation::ref:2' }, '^2'),
123
+ html('a', { href: '#annotation::ref:4' }, '^4'),
124
124
  ]),
125
125
  ]),
126
- html('li', { id: 'annotation:def:3' }, [
126
+ html('li', { id: 'annotation::def:3' }, [
127
127
  '3',
128
- html('sup', [html('a', { href: '#annotation:ref:3' }, '^3')])
128
+ html('sup', [html('a', { href: '#annotation::ref:3' }, '^3')])
129
129
  ]),
130
- html('li', { id: 'annotation:def:4' }, [
130
+ html('li', { id: 'annotation::def:4' }, [
131
131
  '4',
132
- html('sup', [html('a', { href: '#annotation:ref:5' }, '^5')])
132
+ html('sup', [html('a', { href: '#annotation::ref:5' }, '^5')])
133
133
  ]),
134
134
  ]).outerHTML);
135
135
  }
@@ -153,11 +153,11 @@ describe('Unit: parser/processor/footnote', () => {
153
153
  [
154
154
  '<blockquote><blockquote><section><p><sup class="annotation disabled" title="a"><span hidden="">a</span><a>*1</a></sup></p><ol class="annotations"><li data-marker="*1">a<sup><a>^1</a></sup></li></ol><h2>References</h2><ol class="references"></ol></section></blockquote><section><p><sup class="annotation disabled" title="a"><span hidden="">a</span><a>*1</a></sup><br>~~~</p><ol class="annotations"><li data-marker="*1">a<sup><a>^1</a></sup></li></ol><h2>References</h2><ol class="references"></ol></section></blockquote>',
155
155
  '<aside class="example" data-type="markdown"><pre translate="no">((a))</pre><hr><section><p><sup class="annotation disabled" title="a"><span hidden="">a</span><a>*1</a></sup></p><ol class="annotations"><li data-marker="*1">a<sup><a>^1</a></sup></li></ol><h2>References</h2><ol class="references"></ol></section></aside>',
156
- '<p><sup class="annotation" id="annotation:ref:1" title="a"><span hidden="">a</span><a href="#annotation:def:1">*1</a></sup></p>',
156
+ '<p><sup class="annotation" id="annotation::ref:1" title="a"><span hidden="">a</span><a href="#annotation::def:1">*1</a></sup></p>',
157
157
  ]);
158
158
  assert.deepStrictEqual(
159
159
  footnote.outerHTML,
160
- '<ol><li id="annotation:def:1">a<sup><a href="#annotation:ref:1">^1</a></sup></li></ol>');
160
+ '<ol><li id="annotation::def:1">a<sup><a href="#annotation::ref:1">^1</a></sup></li></ol>');
161
161
  }
162
162
  });
163
163
 
@@ -195,50 +195,50 @@ describe('Unit: parser/processor/footnote', () => {
195
195
  [...target.children].map(el => el.outerHTML),
196
196
  [
197
197
  html('p', [
198
- html('sup', { class: "annotation", id: "annotation:ref:1", title: "1" }, [
198
+ html('sup', { class: "annotation", id: "annotation::ref:1", title: "1" }, [
199
199
  html('span', { hidden: '' }, '1'),
200
- html('a', { href: "#annotation:def:1" }, '*1')
200
+ html('a', { href: "#annotation::def:1" }, '*1')
201
201
  ]),
202
202
  ]).outerHTML,
203
203
  html('ol', { class: 'annotations' }, [
204
- html('li', { id: 'annotation:def:1', 'data-marker': '*1' }, [
204
+ html('li', { id: 'annotation::def:1', 'data-marker': '*1' }, [
205
205
  '1',
206
- html('sup', [html('a', { href: '#annotation:ref:1' }, '^1')])
206
+ html('sup', [html('a', { href: '#annotation::ref:1' }, '^1')])
207
207
  ]),
208
208
  ]).outerHTML,
209
- html('h2', { id: 'index:a' }, 'a').outerHTML,
210
- html('h2', { id: 'index:b' }, 'b').outerHTML,
209
+ html('h2', { id: 'index::a' }, 'a').outerHTML,
210
+ html('h2', { id: 'index::b' }, 'b').outerHTML,
211
211
  html('p', [
212
- html('sup', { class: "annotation", id: "annotation:ref:2", title: "2" }, [
212
+ html('sup', { class: "annotation", id: "annotation::ref:2", title: "2" }, [
213
213
  html('span', { hidden: '' }, '2'),
214
- html('a', { href: "#annotation:def:2" }, '*2')
214
+ html('a', { href: "#annotation::def:2" }, '*2')
215
215
  ]),
216
- html('sup', { class: "annotation", id: "annotation:ref:3", title: "3" }, [
216
+ html('sup', { class: "annotation", id: "annotation::ref:3", title: "3" }, [
217
217
  html('span', { hidden: '' }, '3'),
218
- html('a', { href: "#annotation:def:3" }, '*3')
218
+ html('a', { href: "#annotation::def:3" }, '*3')
219
219
  ]),
220
220
  ]).outerHTML,
221
221
  html('ol', { class: 'annotations' }, [
222
- html('li', { id: 'annotation:def:2', 'data-marker': '*2' }, [
222
+ html('li', { id: 'annotation::def:2', 'data-marker': '*2' }, [
223
223
  '2',
224
- html('sup', [html('a', { href: '#annotation:ref:2' }, '^2')])
224
+ html('sup', [html('a', { href: '#annotation::ref:2' }, '^2')])
225
225
  ]),
226
- html('li', { id: 'annotation:def:3', 'data-marker': '*3' }, [
226
+ html('li', { id: 'annotation::def:3', 'data-marker': '*3' }, [
227
227
  '3',
228
- html('sup', [html('a', { href: '#annotation:ref:3' }, '^3')])
228
+ html('sup', [html('a', { href: '#annotation::ref:3' }, '^3')])
229
229
  ]),
230
230
  ]).outerHTML,
231
- html('h2', { id: 'index:c' }, 'c').outerHTML,
231
+ html('h2', { id: 'index::c' }, 'c').outerHTML,
232
232
  html('p', [
233
- html('sup', { class: "annotation", id: "annotation:ref:4", title: "4" }, [
233
+ html('sup', { class: "annotation", id: "annotation::ref:4", title: "4" }, [
234
234
  html('span', { hidden: '' }, '4'),
235
- html('a', { href: "#annotation:def:4" }, '*4')
235
+ html('a', { href: "#annotation::def:4" }, '*4')
236
236
  ]),
237
237
  ]).outerHTML,
238
238
  html('ol', { class: 'annotations' }, [
239
- html('li', { id: 'annotation:def:4', 'data-marker': '*4' }, [
239
+ html('li', { id: 'annotation::def:4', 'data-marker': '*4' }, [
240
240
  '4',
241
- html('sup', [html('a', { href: '#annotation:ref:4' }, '^4')])
241
+ html('sup', [html('a', { href: '#annotation::ref:4' }, '^4')])
242
242
  ]),
243
243
  ]).outerHTML,
244
244
  ]);
@@ -257,18 +257,18 @@ describe('Unit: parser/processor/footnote', () => {
257
257
  [...target.children].map(el => el.outerHTML),
258
258
  [
259
259
  html('p', [
260
- html('sup', { class: "reference", id: "reference:ref:1", title: "a b" }, [
260
+ html('sup', { class: "reference", id: "reference::ref:1", title: "a b" }, [
261
261
  html('span', { hidden: '' }, 'a b'),
262
- html('a', { href: "#reference:def:1" }, '[1]')
262
+ html('a', { href: "#reference::def:1" }, '[1]')
263
263
  ]),
264
264
  ]).outerHTML,
265
265
  ]);
266
266
  assert.deepStrictEqual(
267
267
  footnote.outerHTML,
268
268
  html('ol', [
269
- html('li', { id: 'reference:def:1' }, [
269
+ html('li', { id: 'reference::def:1' }, [
270
270
  'a b',
271
- html('sup', [html('a', { href: '#reference:ref:1' }, '^1')])
271
+ html('sup', [html('a', { href: '#reference::ref:1' }, '^1')])
272
272
  ]),
273
273
  ]).outerHTML);
274
274
  }
@@ -283,29 +283,29 @@ describe('Unit: parser/processor/footnote', () => {
283
283
  [...target.children].map(el => el.outerHTML),
284
284
  [
285
285
  html('p', [
286
- html('sup', { class: "reference", 'data-abbr': "a", id: "reference:ref:1", title: "b" }, [
286
+ html('sup', { class: "reference", 'data-abbr': "a", id: "reference::ref:1", title: "b" }, [
287
287
  html('span', { hidden: '' }),
288
- html('a', { href: "#reference:def:1" }, '[a]')
288
+ html('a', { href: "#reference::def:1" }, '[a]')
289
289
  ]),
290
- html('sup', { class: "reference", 'data-abbr': "a", id: "reference:ref:2", title: "b" }, [
290
+ html('sup', { class: "reference", 'data-abbr': "a", id: "reference::ref:2", title: "b" }, [
291
291
  html('span', { hidden: '' }, 'b'),
292
- html('a', { href: "#reference:def:1" }, '[a]')
292
+ html('a', { href: "#reference::def:1" }, '[a]')
293
293
  ]),
294
- html('sup', { class: "reference", 'data-abbr': "a", id: "reference:ref:3", title: "b" }, [
294
+ html('sup', { class: "reference", 'data-abbr': "a", id: "reference::ref:3", title: "b" }, [
295
295
  html('span', { hidden: '' }),
296
- html('a', { href: "#reference:def:1" }, '[a]')
296
+ html('a', { href: "#reference::def:1" }, '[a]')
297
297
  ]),
298
298
  ]).outerHTML,
299
299
  ]);
300
300
  assert.deepStrictEqual(
301
301
  footnote.outerHTML,
302
302
  html('ol', [
303
- html('li', { id: 'reference:def:1' }, [
303
+ html('li', { id: 'reference::def:1' }, [
304
304
  'b',
305
305
  html('sup', [
306
- html('a', { href: '#reference:ref:1' }, '^1'),
307
- html('a', { href: '#reference:ref:2', title: 'b' }, '^2'),
308
- html('a', { href: '#reference:ref:3' }, '^3'),
306
+ html('a', { href: '#reference::ref:1' }, '^1'),
307
+ html('a', { href: '#reference::ref:2', title: 'b' }, '^2'),
308
+ html('a', { href: '#reference::ref:3' }, '^3'),
309
309
  ])
310
310
  ]),
311
311
  ]).outerHTML);
@@ -52,14 +52,18 @@ function build(
52
52
  len = refs.length, i = 0; i < len; ++i) {
53
53
  yield;
54
54
  const ref = refs[i];
55
- while (+splitters[0]?.compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING) {
55
+ while (splitters.length > 0
56
+ && splitters[0].compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING) {
56
57
  if (defs.size > 0) {
57
58
  total += defs.size;
58
- yield* proc(defs, target.insertBefore(html('ol', { class: `${syntax}s` }), splitters[0] ?? null));
59
+ yield* proc(defs, target.insertBefore(html('ol', { class: `${syntax}s` }), splitters[0]));
60
+ }
61
+ else if (splitters.length % 100 === 0) {
62
+ yield;
59
63
  }
60
64
  splitters.shift();
61
65
  }
62
- const identifier = `${+!ref.querySelector('.label')}:${ref.getAttribute('data-abbr') || '_' + ref.firstElementChild!.innerHTML}`;
66
+ const identifier = ref.getAttribute('data-abbr') || ` ${ref.firstElementChild!.innerHTML}`;
63
67
  const abbr = ref.getAttribute('data-abbr') || undefined;
64
68
  const content = frag(ref.firstElementChild!.cloneNode(true).childNodes);
65
69
  style ??= abbr ? 'abbr' : 'count';
@@ -85,12 +89,8 @@ function build(
85
89
  else {
86
90
  ref.lastChild?.remove();
87
91
  }
88
- const title = undefined
89
- || titles.get(identifier)
90
- || +identifier[0] && ref.title
91
- || text(content).trim()
92
- || content.textContent!.trim()
93
- || undefined;
92
+ const title = titles.get(identifier) || text(content).trim() || undefined;
93
+ assert(title !== '');
94
94
  assert(syntax !== 'annotation' || title);
95
95
  title
96
96
  ? !titles.has(identifier) && titles.set(identifier, title)
@@ -99,13 +99,13 @@ function build(
99
99
  const blank = !!abbr && !content.firstChild;
100
100
  const refIndex = ++count;
101
101
  const refId = opts.id !== ''
102
- ? ref.id || `${syntax}:${opts.id ? `${opts.id}:` : ''}ref:${refIndex}`
102
+ ? `${syntax}:${opts.id ?? ''}:ref:${refIndex}`
103
103
  : undefined;
104
104
  const def = undefined
105
105
  || defs.get(identifier)
106
106
  || defs.set(identifier, html('li',
107
107
  {
108
- id: opts.id !== '' ? `${syntax}:${opts.id ? `${opts.id}:` : ''}def:${total + defs.size + 1}` : undefined,
108
+ id: opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${total + defs.size + 1}` : undefined,
109
109
  'data-marker': !footnote ? marker(total + defs.size + 1, abbr) : undefined,
110
110
  },
111
111
  [content.cloneNode(true), html('sup')]))
@@ -14,7 +14,7 @@ describe('Unit: util/toc', () => {
14
14
  assert.strictEqual(
15
15
  toc(parse('# 1')).outerHTML,
16
16
  html('ul', [
17
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1')]),
17
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1')]),
18
18
  ]).outerHTML);
19
19
  });
20
20
 
@@ -22,7 +22,7 @@ describe('Unit: util/toc', () => {
22
22
  assert.strictEqual(
23
23
  toc(parse('# 1\n\na')).outerHTML,
24
24
  html('ul', [
25
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1')]),
25
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1')]),
26
26
  ]).outerHTML);
27
27
  });
28
28
 
@@ -30,8 +30,8 @@ describe('Unit: util/toc', () => {
30
30
  assert.strictEqual(
31
31
  toc(parse('# 1\n\n# 2')).outerHTML,
32
32
  html('ul', [
33
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1')]),
34
- html('li', [html('a', { href: '#index:2', 'data-index': '2' }, '2')]),
33
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1')]),
34
+ html('li', [html('a', { href: '#index::2', 'data-index': '2' }, '2')]),
35
35
  ]).outerHTML);
36
36
  });
37
37
 
@@ -39,9 +39,9 @@ describe('Unit: util/toc', () => {
39
39
  assert.strictEqual(
40
40
  toc(parse('# 1\n\n## 2')).outerHTML,
41
41
  html('ul', [
42
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1'),
42
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1'),
43
43
  html('ul', [
44
- html('li', [html('a', { href: '#index:2', 'data-index': '1.1' }, '2')]),
44
+ html('li', [html('a', { href: '#index::2', 'data-index': '1.1' }, '2')]),
45
45
  ]),
46
46
  ]),
47
47
  ]).outerHTML);
@@ -51,12 +51,12 @@ describe('Unit: util/toc', () => {
51
51
  assert.strictEqual(
52
52
  toc(parse('# 1\n\n## 2\n\n# 3')).outerHTML,
53
53
  html('ul', [
54
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1'),
54
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1'),
55
55
  html('ul', [
56
- html('li', [html('a', { href: '#index:2', 'data-index': '1.1' }, '2')]),
56
+ html('li', [html('a', { href: '#index::2', 'data-index': '1.1' }, '2')]),
57
57
  ]),
58
58
  ]),
59
- html('li', [html('a', { href: '#index:3', 'data-index': '2' }, '3')]),
59
+ html('li', [html('a', { href: '#index::3', 'data-index': '2' }, '3')]),
60
60
  ]).outerHTML);
61
61
  });
62
62
 
@@ -64,14 +64,14 @@ describe('Unit: util/toc', () => {
64
64
  assert.strictEqual(
65
65
  toc(parse('# 1\n\n## 2\n\n### 3\n\n## 4')).outerHTML,
66
66
  html('ul', [
67
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1'),
67
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1'),
68
68
  html('ul', [
69
- html('li', [html('a', { href: '#index:2', 'data-index': '1.1' }, '2'),
69
+ html('li', [html('a', { href: '#index::2', 'data-index': '1.1' }, '2'),
70
70
  html('ul', [
71
- html('li', [html('a', { href: '#index:3', 'data-index': '1.1.1' }, '3')]),
71
+ html('li', [html('a', { href: '#index::3', 'data-index': '1.1.1' }, '3')]),
72
72
  ]),
73
73
  ]),
74
- html('li', [html('a', { href: '#index:4', 'data-index': '1.2' }, '4')]),
74
+ html('li', [html('a', { href: '#index::4', 'data-index': '1.2' }, '4')]),
75
75
  ]),
76
76
  ]),
77
77
  ]).outerHTML);
@@ -81,16 +81,16 @@ describe('Unit: util/toc', () => {
81
81
  assert.strictEqual(
82
82
  toc(parse('# 1\n\n## 2\n\n### 3\n\n# 4')).outerHTML,
83
83
  html('ul', [
84
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1'),
84
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1'),
85
85
  html('ul', [
86
- html('li', [html('a', { href: '#index:2', 'data-index': '1.1' }, '2'),
86
+ html('li', [html('a', { href: '#index::2', 'data-index': '1.1' }, '2'),
87
87
  html('ul', [
88
- html('li', [html('a', { href: '#index:3', 'data-index': '1.1.1' }, '3')]),
88
+ html('li', [html('a', { href: '#index::3', 'data-index': '1.1.1' }, '3')]),
89
89
  ]),
90
90
  ]),
91
91
  ]),
92
92
  ]),
93
- html('li', [html('a', { href: '#index:4', 'data-index': '2' }, '4')]),
93
+ html('li', [html('a', { href: '#index::4', 'data-index': '2' }, '4')]),
94
94
  ]).outerHTML);
95
95
  });
96
96
 
@@ -98,10 +98,10 @@ describe('Unit: util/toc', () => {
98
98
  assert.strictEqual(
99
99
  toc(parse('# 1\n\n### 2\n\n## 3')).outerHTML,
100
100
  html('ul', [
101
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1'),
101
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1'),
102
102
  html('ul', [
103
- html('li', [html('a', { href: '#index:2', 'data-index': '1.1' }, '2')]),
104
- html('li', [html('a', { href: '#index:3', 'data-index': '1.2' }, '3')]),
103
+ html('li', [html('a', { href: '#index::2', 'data-index': '1.1' }, '2')]),
104
+ html('li', [html('a', { href: '#index::3', 'data-index': '1.2' }, '3')]),
105
105
  ]),
106
106
  ]),
107
107
  ]).outerHTML);
@@ -111,10 +111,10 @@ describe('Unit: util/toc', () => {
111
111
  assert.strictEqual(
112
112
  toc(parse('## 1\n\n# 2\n\n## 3')).outerHTML,
113
113
  html('ul', [
114
- html('li', [html('a', { href: '#index:1', 'data-index': '1' }, '1')]),
115
- html('li', [html('a', { href: '#index:2', 'data-index': '2' }, '2'),
114
+ html('li', [html('a', { href: '#index::1', 'data-index': '1' }, '1')]),
115
+ html('li', [html('a', { href: '#index::2', 'data-index': '2' }, '2'),
116
116
  html('ul', [
117
- html('li', [html('a', { href: '#index:3', 'data-index': '2.1' }, '3')]),
117
+ html('li', [html('a', { href: '#index::3', 'data-index': '2.1' }, '3')]),
118
118
  ]),
119
119
  ]),
120
120
  ]).outerHTML);
@@ -124,12 +124,12 @@ describe('Unit: util/toc', () => {
124
124
  assert.strictEqual(
125
125
  toc(parse('~~~aside\n# 1\n~~~\n\n# 2\n\n## 3\n\n~~~aside\n## 4\n~~~\n\n## 5')).outerHTML,
126
126
  html('ul', [
127
- html('li', [html('a', { href: '#index:1' }, '1')]),
128
- html('li', [html('a', { href: '#index:2', 'data-index': '1' }, '2'),
127
+ html('li', [html('a', { href: '#index::1' }, '1')]),
128
+ html('li', [html('a', { href: '#index::2', 'data-index': '1' }, '2'),
129
129
  html('ul', [
130
- html('li', [html('a', { href: '#index:3', 'data-index': '1.1' }, '3')]),
131
- html('li', [html('a', { href: '#index:4' }, '4')]),
132
- html('li', [html('a', { href: '#index:5', 'data-index': '1.2' }, '5')]),
130
+ html('li', [html('a', { href: '#index::3', 'data-index': '1.1' }, '3')]),
131
+ html('li', [html('a', { href: '#index::4' }, '4')]),
132
+ html('li', [html('a', { href: '#index::5', 'data-index': '1.2' }, '5')]),
133
133
  ]),
134
134
  ]),
135
135
  ]).outerHTML);
@@ -1,31 +0,0 @@
1
- import { horizontalrule } from './horizontalrule';
2
- import { some } from '../../combinator';
3
- import { inspect } from '../../debug.test';
4
-
5
- describe('Unit: parser/block/horizontalrule', () => {
6
- describe('horizontalrule', () => {
7
- const parser = (source: string) => some(horizontalrule)({ source, context: {} });
8
-
9
- it('invalid', () => {
10
- assert.deepStrictEqual(inspect(parser('')), undefined);
11
- assert.deepStrictEqual(inspect(parser('\n')), undefined);
12
- assert.deepStrictEqual(inspect(parser('-')), undefined);
13
- assert.deepStrictEqual(inspect(parser('--')), undefined);
14
- assert.deepStrictEqual(inspect(parser('--\n-')), undefined);
15
- assert.deepStrictEqual(inspect(parser('---a')), undefined);
16
- assert.deepStrictEqual(inspect(parser('---\na')), undefined);
17
- assert.deepStrictEqual(inspect(parser('- - -')), undefined);
18
- assert.deepStrictEqual(inspect(parser(' ---')), undefined);
19
- assert.deepStrictEqual(inspect(parser('***')), undefined);
20
- });
21
-
22
- it('valid', () => {
23
- assert.deepStrictEqual(inspect(parser('---')), [['<hr>'], '']);
24
- assert.deepStrictEqual(inspect(parser('--- ')), [['<hr>'], '']);
25
- assert.deepStrictEqual(inspect(parser('---\n')), [['<hr>'], '']);
26
- assert.deepStrictEqual(inspect(parser('----')), [['<hr>'], '']);
27
- });
28
-
29
- });
30
-
31
- });
@@ -1,7 +0,0 @@
1
- import { HorizontalRuleParser } from '../block';
2
- import { block, line, focus } from '../../combinator';
3
- import { html } from 'typed-dom/dom';
4
-
5
- export const horizontalrule: HorizontalRuleParser = block(line(focus(
6
- /^-{3,}[^\S\n]*(?:$|\n)/,
7
- () => [[html('hr')], ''])));