securemark 0.261.0 → 0.262.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/CHANGELOG.md +12 -0
- package/dist/index.js +1117 -646
- package/markdown.d.ts +0 -11
- package/package.json +9 -9
- package/src/combinator/data/parser/context/memo.ts +1 -1
- package/src/combinator/data/parser/inits.ts +1 -1
- package/src/combinator/data/parser/sequence.ts +1 -1
- package/src/debug.test.ts +3 -3
- package/src/parser/api/bind.ts +2 -2
- package/src/parser/api/parse.test.ts +1 -1
- package/src/parser/api/parse.ts +1 -1
- package/src/parser/block/blockquote.test.ts +31 -31
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/dlist.ts +1 -1
- package/src/parser/block/extension/aside.test.ts +3 -3
- package/src/parser/block/extension/aside.ts +1 -0
- package/src/parser/block/extension/example.test.ts +11 -11
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/block/extension/fig.test.ts +5 -5
- package/src/parser/block/extension/figure.test.ts +2 -2
- package/src/parser/block/extension/figure.ts +1 -1
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/olist.ts +5 -7
- package/src/parser/block/reply.ts +1 -1
- package/src/parser/block/table.ts +8 -8
- package/src/parser/block/ulist.ts +1 -1
- package/src/parser/block.ts +1 -1
- package/src/parser/inline/bracket.ts +1 -1
- package/src/parser/inline/comment.ts +1 -1
- package/src/parser/inline/deletion.ts +2 -2
- package/src/parser/inline/emphasis.ts +3 -3
- package/src/parser/inline/extension/indexee.ts +9 -8
- package/src/parser/inline/extension/placeholder.ts +1 -1
- package/src/parser/inline/html.ts +1 -1
- package/src/parser/inline/insertion.ts +2 -2
- package/src/parser/inline/link.ts +1 -1
- package/src/parser/inline/mark.ts +2 -2
- package/src/parser/inline/media.ts +1 -1
- package/src/parser/inline/ruby.ts +1 -1
- package/src/parser/inline/strong.ts +3 -3
- package/src/parser/inline/template.ts +1 -1
- package/src/parser/inline.ts +0 -3
- package/src/parser/locale/ja.ts +1 -1
- package/src/parser/locale.test.ts +1 -1
- package/src/parser/locale.ts +5 -4
- package/src/parser/processor/figure.test.ts +3 -3
- package/src/parser/processor/figure.ts +10 -8
- package/src/parser/processor/footnote.test.ts +2 -2
- package/src/parser/processor/footnote.ts +17 -12
- package/src/parser/source/str.ts +4 -2
- package/src/parser/source/text.ts +2 -2
- package/src/renderer/render.ts +3 -3
- package/src/util/info.ts +7 -5
- package/src/util/quote.ts +14 -12
- package/src/util/toc.ts +14 -8
- package/src/parser/inline/escape.ts +0 -21
package/src/util/toc.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { undefined } from 'spica/global';
|
|
2
|
-
import { html } from 'typed-dom/dom';
|
|
3
|
-
import { duffEach, duffReduce } from 'spica/duff';
|
|
4
2
|
import { push } from 'spica/array';
|
|
3
|
+
import { html } from 'typed-dom/dom';
|
|
4
|
+
import { querySelectorAll } from 'typed-dom/query';
|
|
5
5
|
|
|
6
6
|
// Bug: Firefox
|
|
7
7
|
//const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `:scope > ${s}[id]`).join();
|
|
8
8
|
const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]';
|
|
9
9
|
|
|
10
10
|
export function toc(source: DocumentFragment | HTMLElement | ShadowRoot): HTMLUListElement {
|
|
11
|
-
const hs =
|
|
11
|
+
const hs: HTMLHeadingElement[] = [];
|
|
12
|
+
for (let es = querySelectorAll(source, selector), i = 0; i < es.length; ++i) {
|
|
13
|
+
const el = es[i];
|
|
12
14
|
assert(el.parentNode === source);
|
|
13
15
|
switch (el.tagName) {
|
|
14
16
|
case 'ASIDE':
|
|
15
|
-
|
|
17
|
+
hs.push(html(el.firstElementChild!.tagName.toLowerCase() as 'h1', { id: el.id, class: 'aside' }, el.firstElementChild!.cloneNode(true).childNodes));
|
|
18
|
+
continue;
|
|
16
19
|
default:
|
|
17
|
-
|
|
20
|
+
hs.push(el as HTMLHeadingElement);
|
|
21
|
+
continue;
|
|
18
22
|
}
|
|
19
|
-
}
|
|
23
|
+
}
|
|
20
24
|
return parse(cons(hs));
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -58,7 +62,9 @@ function level(h: HTMLHeadingElement): number {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
function unlink(h: HTMLHeadingElement): Iterable<Node> {
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
for (let es = h.getElementsByTagName('a'), len = es.length, i = 0; i < len; ++i) {
|
|
66
|
+
const el = es[i];
|
|
67
|
+
el.replaceWith(...el.childNodes);
|
|
68
|
+
}
|
|
63
69
|
return h.childNodes;
|
|
64
70
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
|
-
import { EscapeParser } from '../inline';
|
|
3
|
-
import { union } from '../../combinator';
|
|
4
|
-
import { str } from '../source';
|
|
5
|
-
|
|
6
|
-
const repeat = str(/^(.)\1*/);
|
|
7
|
-
|
|
8
|
-
export const escape: EscapeParser = union([({ source, context }) => {
|
|
9
|
-
switch (source[0]) {
|
|
10
|
-
case '+':
|
|
11
|
-
case '~':
|
|
12
|
-
case '=':
|
|
13
|
-
if (!source[2]) return;
|
|
14
|
-
return source[2] === source[0]
|
|
15
|
-
&& source[1] === source[0]
|
|
16
|
-
? repeat({ source, context })
|
|
17
|
-
: undefined;
|
|
18
|
-
default:
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
}]);
|