securemark 0.240.2 → 0.241.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 +4 -0
- package/dist/securemark.js +1156 -2686
- package/index.d.ts +0 -1
- package/package-lock.json +100 -34
- package/package.json +4 -4
- package/src/combinator/control/manipulation/fallback.ts +0 -1
- package/src/combinator/control/manipulation/indent.ts +3 -3
- package/src/debug.test.ts +1 -1
- package/src/parser/api/bind.test.ts +1 -1
- package/src/parser/api/parse.test.ts +1 -1
- package/src/parser/api/parse.ts +1 -1
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/codeblock.ts +1 -1
- package/src/parser/block/dlist.ts +1 -1
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/block/extension/figbase.ts +1 -1
- package/src/parser/block/extension/figure.ts +1 -1
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/placeholder.ts +1 -1
- package/src/parser/block/extension/table.test.ts +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/heading.ts +1 -1
- package/src/parser/block/horizontalrule.ts +1 -1
- package/src/parser/block/ilist.ts +1 -1
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block/olist.ts +6 -6
- package/src/parser/block/paragraph.ts +1 -1
- package/src/parser/block/reply/cite.ts +1 -1
- package/src/parser/block/reply/quote.ts +1 -1
- package/src/parser/block/reply.ts +1 -1
- package/src/parser/block/table.ts +1 -1
- package/src/parser/block/ulist.ts +1 -1
- package/src/parser/block.ts +1 -1
- package/src/parser/header.ts +1 -1
- package/src/parser/inline/annotation.ts +1 -1
- package/src/parser/inline/autolink/account.ts +1 -1
- package/src/parser/inline/autolink/anchor.ts +1 -1
- package/src/parser/inline/autolink/channel.ts +1 -1
- package/src/parser/inline/autolink/email.ts +1 -1
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.ts +1 -1
- package/src/parser/inline/bracket.ts +1 -1
- package/src/parser/inline/code.ts +1 -1
- package/src/parser/inline/comment.ts +1 -1
- package/src/parser/inline/deletion.ts +1 -1
- package/src/parser/inline/emphasis.ts +1 -1
- package/src/parser/inline/emstrong.ts +1 -1
- package/src/parser/inline/extension/index.ts +1 -1
- package/src/parser/inline/extension/indexee.ts +1 -1
- package/src/parser/inline/extension/indexer.ts +1 -1
- package/src/parser/inline/extension/label.ts +1 -1
- package/src/parser/inline/extension/placeholder.ts +1 -1
- package/src/parser/inline/html.ts +1 -1
- package/src/parser/inline/htmlentity.ts +1 -1
- package/src/parser/inline/insertion.ts +1 -1
- package/src/parser/inline/link.ts +1 -1
- package/src/parser/inline/mark.ts +1 -1
- package/src/parser/inline/math.ts +1 -1
- package/src/parser/inline/media.ts +1 -1
- package/src/parser/inline/reference.ts +1 -1
- package/src/parser/inline/ruby.ts +1 -1
- package/src/parser/inline/strong.ts +1 -1
- package/src/parser/inline/template.ts +1 -1
- package/src/parser/locale.ts +1 -1
- package/src/parser/processor/figure.test.ts +1 -1
- package/src/parser/processor/figure.ts +1 -1
- package/src/parser/processor/footnote.test.ts +1 -1
- package/src/parser/processor/footnote.ts +5 -4
- package/src/parser/source/text.ts +1 -1
- package/src/renderer/render/math.ts +1 -1
- package/src/renderer/render/media/audio.ts +1 -1
- package/src/renderer/render/media/image.ts +1 -1
- package/src/renderer/render/media/pdf.ts +1 -1
- package/src/renderer/render/media/twitter.ts +21 -23
- package/src/renderer/render/media/video.ts +1 -1
- package/src/renderer/render/media/youtube.ts +1 -1
- package/src/renderer/render/media.test.ts +1 -1
- package/src/util/quote.ts +1 -1
- package/src/util/toc.test.ts +1 -1
- package/src/util/toc.ts +1 -1
- package/src/util.ts +0 -1
- package/src/util/sync.ts +0 -57
package/index.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export function quote(anchor: string, range: Range): string;
|
|
|
23
23
|
export function toc(source: DocumentFragment | HTMLElement | ShadowRoot): HTMLUListElement;
|
|
24
24
|
export function info(source: DocumentFragment | HTMLElement | ShadowRoot): Info;
|
|
25
25
|
export function scope(base: DocumentFragment | HTMLElement | ShadowRoot, filter?: string, bound?: string): (el: Element) => boolean;
|
|
26
|
-
export function sync(editor: HTMLElement, viewer: HTMLElement, bottom?: Element | null): () => void;
|
|
27
26
|
|
|
28
27
|
export type ParserOptions = Omit<Partial<ParserSettings>, 'chunk'>;
|
|
29
28
|
export interface ParserSettings {
|
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.241.0",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -364,9 +364,9 @@
|
|
|
364
364
|
"dev": true
|
|
365
365
|
},
|
|
366
366
|
"@jridgewell/resolve-uri": {
|
|
367
|
-
"version": "3.0.
|
|
368
|
-
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.
|
|
369
|
-
"integrity": "sha512-
|
|
367
|
+
"version": "3.0.6",
|
|
368
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz",
|
|
369
|
+
"integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==",
|
|
370
370
|
"dev": true
|
|
371
371
|
},
|
|
372
372
|
"@jridgewell/sourcemap-codec": {
|
|
@@ -376,9 +376,9 @@
|
|
|
376
376
|
"dev": true
|
|
377
377
|
},
|
|
378
378
|
"@jridgewell/trace-mapping": {
|
|
379
|
-
"version": "0.3.
|
|
380
|
-
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.
|
|
381
|
-
"integrity": "sha512-
|
|
379
|
+
"version": "0.3.9",
|
|
380
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
|
381
|
+
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
|
382
382
|
"dev": true,
|
|
383
383
|
"requires": {
|
|
384
384
|
"@jridgewell/resolve-uri": "^3.0.3",
|
|
@@ -596,9 +596,9 @@
|
|
|
596
596
|
"dev": true
|
|
597
597
|
},
|
|
598
598
|
"@types/mocha": {
|
|
599
|
-
"version": "9.1.
|
|
600
|
-
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.
|
|
601
|
-
"integrity": "sha512-
|
|
599
|
+
"version": "9.1.1",
|
|
600
|
+
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz",
|
|
601
|
+
"integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==",
|
|
602
602
|
"dev": true
|
|
603
603
|
},
|
|
604
604
|
"@types/node": {
|
|
@@ -1767,16 +1767,16 @@
|
|
|
1767
1767
|
"dev": true
|
|
1768
1768
|
},
|
|
1769
1769
|
"cacache": {
|
|
1770
|
-
"version": "16.0.
|
|
1771
|
-
"resolved": "https://registry.npmjs.org/cacache/-/cacache-16.0.
|
|
1772
|
-
"integrity": "sha512-
|
|
1770
|
+
"version": "16.0.6",
|
|
1771
|
+
"resolved": "https://registry.npmjs.org/cacache/-/cacache-16.0.6.tgz",
|
|
1772
|
+
"integrity": "sha512-9a/MLxGaw3LEGes0HaPez2RgZWDV6X0jrgChsuxfEh8xoDoYGxaGrkMe7Dlyjrb655tA/b8fX0qlUg6Ii5MBvw==",
|
|
1773
1773
|
"dev": true,
|
|
1774
1774
|
"requires": {
|
|
1775
1775
|
"@npmcli/fs": "^2.1.0",
|
|
1776
1776
|
"@npmcli/move-file": "^2.0.0",
|
|
1777
1777
|
"chownr": "^2.0.0",
|
|
1778
1778
|
"fs-minipass": "^2.1.0",
|
|
1779
|
-
"glob": "^
|
|
1779
|
+
"glob": "^8.0.1",
|
|
1780
1780
|
"infer-owner": "^1.0.4",
|
|
1781
1781
|
"lru-cache": "^7.7.1",
|
|
1782
1782
|
"minipass": "^3.1.6",
|
|
@@ -1792,6 +1792,38 @@
|
|
|
1792
1792
|
"unique-filename": "^1.1.1"
|
|
1793
1793
|
},
|
|
1794
1794
|
"dependencies": {
|
|
1795
|
+
"brace-expansion": {
|
|
1796
|
+
"version": "2.0.1",
|
|
1797
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
|
1798
|
+
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
|
1799
|
+
"dev": true,
|
|
1800
|
+
"requires": {
|
|
1801
|
+
"balanced-match": "^1.0.0"
|
|
1802
|
+
}
|
|
1803
|
+
},
|
|
1804
|
+
"glob": {
|
|
1805
|
+
"version": "8.0.1",
|
|
1806
|
+
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.1.tgz",
|
|
1807
|
+
"integrity": "sha512-cF7FYZZ47YzmCu7dDy50xSRRfO3ErRfrXuLZcNIuyiJEco0XSrGtuilG19L5xp3NcwTx7Gn+X6Tv3fmsUPTbow==",
|
|
1808
|
+
"dev": true,
|
|
1809
|
+
"requires": {
|
|
1810
|
+
"fs.realpath": "^1.0.0",
|
|
1811
|
+
"inflight": "^1.0.4",
|
|
1812
|
+
"inherits": "2",
|
|
1813
|
+
"minimatch": "^5.0.1",
|
|
1814
|
+
"once": "^1.3.0",
|
|
1815
|
+
"path-is-absolute": "^1.0.0"
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
"minimatch": {
|
|
1819
|
+
"version": "5.0.1",
|
|
1820
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
|
|
1821
|
+
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
|
|
1822
|
+
"dev": true,
|
|
1823
|
+
"requires": {
|
|
1824
|
+
"brace-expansion": "^2.0.1"
|
|
1825
|
+
}
|
|
1826
|
+
},
|
|
1795
1827
|
"mkdirp": {
|
|
1796
1828
|
"version": "1.0.4",
|
|
1797
1829
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
|
@@ -3026,9 +3058,9 @@
|
|
|
3026
3058
|
"dev": true
|
|
3027
3059
|
},
|
|
3028
3060
|
"electron-to-chromium": {
|
|
3029
|
-
"version": "1.4.
|
|
3030
|
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.
|
|
3031
|
-
"integrity": "sha512-
|
|
3061
|
+
"version": "1.4.118",
|
|
3062
|
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.118.tgz",
|
|
3063
|
+
"integrity": "sha512-maZIKjnYDvF7Fs35nvVcyr44UcKNwybr93Oba2n3HkKDFAtk0svERkLN/HyczJDS3Fo4wU9th9fUQd09ZLtj1w==",
|
|
3032
3064
|
"dev": true
|
|
3033
3065
|
},
|
|
3034
3066
|
"elliptic": {
|
|
@@ -3245,9 +3277,9 @@
|
|
|
3245
3277
|
}
|
|
3246
3278
|
},
|
|
3247
3279
|
"es5-ext": {
|
|
3248
|
-
"version": "0.10.
|
|
3249
|
-
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.
|
|
3250
|
-
"integrity": "sha512-
|
|
3280
|
+
"version": "0.10.61",
|
|
3281
|
+
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz",
|
|
3282
|
+
"integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==",
|
|
3251
3283
|
"dev": true,
|
|
3252
3284
|
"requires": {
|
|
3253
3285
|
"es6-iterator": "^2.0.3",
|
|
@@ -8190,15 +8222,49 @@
|
|
|
8190
8222
|
}
|
|
8191
8223
|
},
|
|
8192
8224
|
"npm-packlist": {
|
|
8193
|
-
"version": "5.0.
|
|
8194
|
-
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-5.0.
|
|
8195
|
-
"integrity": "sha512-
|
|
8225
|
+
"version": "5.0.2",
|
|
8226
|
+
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-5.0.2.tgz",
|
|
8227
|
+
"integrity": "sha512-jLhcNisUgpz6v2KC75qSeEYAM8UBMYjQ2OhlCOJjB4Ovu7XXnD25UqZ6hOQNeGShL/2ju3LL2E/zBbsuzkIQ8w==",
|
|
8196
8228
|
"dev": true,
|
|
8197
8229
|
"requires": {
|
|
8198
|
-
"glob": "^
|
|
8230
|
+
"glob": "^8.0.1",
|
|
8199
8231
|
"ignore-walk": "^5.0.1",
|
|
8200
8232
|
"npm-bundled": "^1.1.2",
|
|
8201
8233
|
"npm-normalize-package-bin": "^1.0.1"
|
|
8234
|
+
},
|
|
8235
|
+
"dependencies": {
|
|
8236
|
+
"brace-expansion": {
|
|
8237
|
+
"version": "2.0.1",
|
|
8238
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
|
8239
|
+
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
|
8240
|
+
"dev": true,
|
|
8241
|
+
"requires": {
|
|
8242
|
+
"balanced-match": "^1.0.0"
|
|
8243
|
+
}
|
|
8244
|
+
},
|
|
8245
|
+
"glob": {
|
|
8246
|
+
"version": "8.0.1",
|
|
8247
|
+
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.1.tgz",
|
|
8248
|
+
"integrity": "sha512-cF7FYZZ47YzmCu7dDy50xSRRfO3ErRfrXuLZcNIuyiJEco0XSrGtuilG19L5xp3NcwTx7Gn+X6Tv3fmsUPTbow==",
|
|
8249
|
+
"dev": true,
|
|
8250
|
+
"requires": {
|
|
8251
|
+
"fs.realpath": "^1.0.0",
|
|
8252
|
+
"inflight": "^1.0.4",
|
|
8253
|
+
"inherits": "2",
|
|
8254
|
+
"minimatch": "^5.0.1",
|
|
8255
|
+
"once": "^1.3.0",
|
|
8256
|
+
"path-is-absolute": "^1.0.0"
|
|
8257
|
+
}
|
|
8258
|
+
},
|
|
8259
|
+
"minimatch": {
|
|
8260
|
+
"version": "5.0.1",
|
|
8261
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
|
|
8262
|
+
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
|
|
8263
|
+
"dev": true,
|
|
8264
|
+
"requires": {
|
|
8265
|
+
"brace-expansion": "^2.0.1"
|
|
8266
|
+
}
|
|
8267
|
+
}
|
|
8202
8268
|
}
|
|
8203
8269
|
},
|
|
8204
8270
|
"npm-pick-manifest": {
|
|
@@ -8246,14 +8312,14 @@
|
|
|
8246
8312
|
}
|
|
8247
8313
|
},
|
|
8248
8314
|
"npmlog": {
|
|
8249
|
-
"version": "6.0.
|
|
8250
|
-
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.
|
|
8251
|
-
"integrity": "sha512
|
|
8315
|
+
"version": "6.0.2",
|
|
8316
|
+
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz",
|
|
8317
|
+
"integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==",
|
|
8252
8318
|
"dev": true,
|
|
8253
8319
|
"requires": {
|
|
8254
8320
|
"are-we-there-yet": "^3.0.0",
|
|
8255
8321
|
"console-control-strings": "^1.1.0",
|
|
8256
|
-
"gauge": "^4.0.
|
|
8322
|
+
"gauge": "^4.0.3",
|
|
8257
8323
|
"set-blocking": "^2.0.0"
|
|
8258
8324
|
}
|
|
8259
8325
|
},
|
|
@@ -10365,9 +10431,9 @@
|
|
|
10365
10431
|
"dev": true
|
|
10366
10432
|
},
|
|
10367
10433
|
"spica": {
|
|
10368
|
-
"version": "0.0.
|
|
10369
|
-
"resolved": "https://registry.npmjs.org/spica/-/spica-0.0.
|
|
10370
|
-
"integrity": "sha512-
|
|
10434
|
+
"version": "0.0.521",
|
|
10435
|
+
"resolved": "https://registry.npmjs.org/spica/-/spica-0.0.521.tgz",
|
|
10436
|
+
"integrity": "sha512-3WxY7K1QbcMA/9b85F5DsKQutzXJshtKejsudJTIXZovzVWlfdwnBAbQ5opFFiV5/ThDnYnKMO+qvVMNMjB3MQ==",
|
|
10371
10437
|
"dev": true
|
|
10372
10438
|
},
|
|
10373
10439
|
"split-string": {
|
|
@@ -11012,9 +11078,9 @@
|
|
|
11012
11078
|
"dev": true
|
|
11013
11079
|
},
|
|
11014
11080
|
"typed-dom": {
|
|
11015
|
-
"version": "0.0.
|
|
11016
|
-
"resolved": "https://registry.npmjs.org/typed-dom/-/typed-dom-0.0.
|
|
11017
|
-
"integrity": "sha512-
|
|
11081
|
+
"version": "0.0.253",
|
|
11082
|
+
"resolved": "https://registry.npmjs.org/typed-dom/-/typed-dom-0.0.253.tgz",
|
|
11083
|
+
"integrity": "sha512-g6GJQqmmF7EaMcExhKsOdeTubRS5GuarLctB78EhCHfIxCopWZ5QvrCbygzIFkjEh/zATZlZjLxacYQ+WRHtvg==",
|
|
11018
11084
|
"dev": true
|
|
11019
11085
|
},
|
|
11020
11086
|
"typedarray": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.241.0",
|
|
4
4
|
"description": "Secure markdown renderer working on browsers for user input data.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/falsandtru/securemark",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/dompurify": "2.3.3",
|
|
34
34
|
"@types/jquery": "3.5.14",
|
|
35
35
|
"@types/mathjax": "0.0.37",
|
|
36
|
-
"@types/mocha": "9.1.
|
|
36
|
+
"@types/mocha": "9.1.1",
|
|
37
37
|
"@types/power-assert": "1.5.8",
|
|
38
38
|
"@types/prismjs": "1.26.0",
|
|
39
39
|
"browserify": "^17.0.0",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"npm-check-updates": "^12.5.9",
|
|
62
62
|
"power-assert": "^1.6.1",
|
|
63
63
|
"semver": "^7.3.7",
|
|
64
|
-
"spica": "0.0.
|
|
64
|
+
"spica": "0.0.521",
|
|
65
65
|
"tsify": "^5.0.4",
|
|
66
|
-
"typed-dom": "0.0.
|
|
66
|
+
"typed-dom": "0.0.253",
|
|
67
67
|
"typescript": "4.6.3",
|
|
68
68
|
"vinyl-buffer": "^1.0.1",
|
|
69
69
|
"vinyl-source-stream": "^2.0.0"
|
|
@@ -2,7 +2,6 @@ import { Parser, Tree, Context } from '../../data/parser';
|
|
|
2
2
|
import { union } from '../../data/parser/union';
|
|
3
3
|
|
|
4
4
|
export function fallback<P extends Parser<unknown>>(parser: P, otherwise: Parser<Tree<P>, Context<P>>): P;
|
|
5
|
-
export function fallback<T, P extends Parser<T>>(parser: P, otherwise: Parser<T, Context<P>>): P;
|
|
6
5
|
export function fallback<T>(parser: Parser<T>, otherwise: Parser<T>): Parser<T> {
|
|
7
6
|
return union([parser, otherwise]);
|
|
8
7
|
}
|
|
@@ -5,7 +5,7 @@ import { line } from '../constraint/line';
|
|
|
5
5
|
import { bind } from '../monad/bind';
|
|
6
6
|
import { match } from './match';
|
|
7
7
|
import { open } from './surround';
|
|
8
|
-
import {
|
|
8
|
+
import { memoize } from 'spica/memoize';
|
|
9
9
|
import { join } from 'spica/array';
|
|
10
10
|
|
|
11
11
|
export function indent<P extends Parser<unknown>>(parser: P): P;
|
|
@@ -13,10 +13,10 @@ export function indent<T>(parser: Parser<T>): Parser<T> {
|
|
|
13
13
|
assert(parser);
|
|
14
14
|
return bind(match(
|
|
15
15
|
/^(?=(([ \t])\2*))/,
|
|
16
|
-
|
|
16
|
+
memoize(
|
|
17
17
|
([, indent]) =>
|
|
18
18
|
some(line(open(indent, source => [[unline(source)], '']))),
|
|
19
|
-
([, indent]) => indent)),
|
|
19
|
+
([, indent]) => indent.length * 2 + +(indent[0] === ' '), [])),
|
|
20
20
|
(nodes, rest, context) => {
|
|
21
21
|
const result = parser(join(nodes, '\n'), context);
|
|
22
22
|
return result && exec(result) === ''
|
package/src/debug.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result, eval, exec } from './combinator/data/parser';
|
|
2
|
-
import { html, define } from 'typed-dom';
|
|
2
|
+
import { html, define } from 'typed-dom/dom';
|
|
3
3
|
|
|
4
4
|
export function inspect(result: Result<HTMLElement | string>, until: number | string = Infinity): Result<string> {
|
|
5
5
|
return result && [
|
package/src/parser/api/parse.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { normalize } from './normalize';
|
|
|
9
9
|
import { headers } from './header';
|
|
10
10
|
import { figure } from '../processor/figure';
|
|
11
11
|
import { footnote } from '../processor/footnote';
|
|
12
|
-
import { frag } from 'typed-dom';
|
|
12
|
+
import { frag } from 'typed-dom/dom';
|
|
13
13
|
import { ReadonlyURL } from 'spica/url';
|
|
14
14
|
|
|
15
15
|
interface Options extends ParserOptions {
|
|
@@ -3,7 +3,7 @@ import { union, some, block, validate, rewrite, creator, open, convert, lazy, fm
|
|
|
3
3
|
import { autolink } from '../autolink';
|
|
4
4
|
import { contentline } from '../source';
|
|
5
5
|
import { parse } from '../api/parse';
|
|
6
|
-
import { html, defrag } from 'typed-dom';
|
|
6
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
7
7
|
|
|
8
8
|
export const segment: BlockquoteParser.SegmentParser = block(validate(['!>', '>'], union([
|
|
9
9
|
validate(/^!?>+(?=[^\S\n]|\n[^\S\n]*\S)/, some(contentline)),
|
|
@@ -3,7 +3,7 @@ import { CodeBlockParser } from '../block';
|
|
|
3
3
|
import { eval } from '../../combinator/data/parser';
|
|
4
4
|
import { some, block, validate, fence, clear, fmap } from '../../combinator';
|
|
5
5
|
import { autolink } from '../autolink';
|
|
6
|
-
import { html, defrag } from 'typed-dom';
|
|
6
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
7
7
|
|
|
8
8
|
const opener = /^(`{3,})(?!`)([^\n]*)(?:$|\n)/;
|
|
9
9
|
const language = /^[0-9a-z]+(?:-[a-z][0-9a-z]*)*$/i;
|
|
@@ -4,7 +4,7 @@ import { inline, indexee, indexer } from '../inline';
|
|
|
4
4
|
import { anyline } from '../source';
|
|
5
5
|
import { localize } from '../locale';
|
|
6
6
|
import { visualize } from '../util';
|
|
7
|
-
import { html, defrag } from 'typed-dom';
|
|
7
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
8
8
|
import { push } from 'spica/array';
|
|
9
9
|
|
|
10
10
|
export const dlist: DListParser = lazy(() => block(localize(fmap(validate(
|
|
@@ -2,7 +2,7 @@ import { ExtensionParser } from '../../block';
|
|
|
2
2
|
import { block, validate, fence, creator, fmap } from '../../../combinator';
|
|
3
3
|
import { identity, text } from '../../inline/extension/indexee';
|
|
4
4
|
import { parse } from '../../api/parse';
|
|
5
|
-
import { html } from 'typed-dom';
|
|
5
|
+
import { html } from 'typed-dom/dom';
|
|
6
6
|
|
|
7
7
|
export const aside: ExtensionParser.AsideParser = creator(100, block(validate('~~~', fmap(
|
|
8
8
|
fence(/^(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/, 300),
|
|
@@ -3,7 +3,7 @@ import { eval } from '../../../combinator/data/parser';
|
|
|
3
3
|
import { block, validate, fence, creator, fmap } from '../../../combinator';
|
|
4
4
|
import { parse } from '../../api/parse';
|
|
5
5
|
import { mathblock } from '../mathblock';
|
|
6
|
-
import { html } from 'typed-dom';
|
|
6
|
+
import { html } from 'typed-dom/dom';
|
|
7
7
|
|
|
8
8
|
const opener = /^(~{3,})(?:example\/(\S+)|(?!\S))([^\n]*)(?:$|\n)/;
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtensionParser } from '../../block';
|
|
2
2
|
import { union, block, line, validate, fmap } from '../../../combinator';
|
|
3
3
|
import { label } from '../../inline/extension/label';
|
|
4
|
-
import { html } from 'typed-dom';
|
|
4
|
+
import { html } from 'typed-dom/dom';
|
|
5
5
|
|
|
6
6
|
export const figbase: ExtensionParser.FigbaseParser = block(fmap(
|
|
7
7
|
validate(/^\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?!\S|\n[^\S\n]*\S)/,
|
|
@@ -15,7 +15,7 @@ import { placeholder, segment_ as seg_placeholder } from './placeholder';
|
|
|
15
15
|
import { inline, media, shortmedia } from '../../inline';
|
|
16
16
|
import { localize } from '../../locale';
|
|
17
17
|
import { visualize } from '../../util';
|
|
18
|
-
import { html, defrag } from 'typed-dom';
|
|
18
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
19
19
|
import { memoize } from 'spica/memoize';
|
|
20
20
|
import { unshift } from 'spica/array';
|
|
21
21
|
|
|
@@ -11,7 +11,7 @@ import { codeblock } from '../codeblock';
|
|
|
11
11
|
import { mathblock } from '../mathblock';
|
|
12
12
|
import { blockquote } from '../blockquote';
|
|
13
13
|
import { paragraph } from '../paragraph';
|
|
14
|
-
import { html } from 'typed-dom';
|
|
14
|
+
import { html } from 'typed-dom/dom';
|
|
15
15
|
import { unshift, push } from 'spica/array';
|
|
16
16
|
|
|
17
17
|
import MessageParser = ExtensionParser.MessageParser;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { table } from './table';
|
|
2
2
|
import { some } from '../../../combinator';
|
|
3
3
|
import { inspect } from '../../../debug.test';
|
|
4
|
-
import { html } from 'typed-dom';
|
|
4
|
+
import { html } from 'typed-dom/dom';
|
|
5
5
|
|
|
6
6
|
describe('Unit: parser/block/extension/table', () => {
|
|
7
7
|
describe('table', () => {
|
|
@@ -7,7 +7,7 @@ import { inline } from '../../inline';
|
|
|
7
7
|
import { str, anyline, emptyline, contentline } from '../../source';
|
|
8
8
|
import { localize } from '../../locale';
|
|
9
9
|
import { visualize } from '../../util';
|
|
10
|
-
import { html, defrag } from 'typed-dom';
|
|
10
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
11
11
|
import { unshift, splice } from 'spica/array';
|
|
12
12
|
|
|
13
13
|
import TableParser = ExtensionParser.TableParser;
|
|
@@ -3,7 +3,7 @@ import { union, some, block, line, validate, focus, rewrite, context, open, trim
|
|
|
3
3
|
import { inline, indexee, indexer } from '../inline';
|
|
4
4
|
import { str } from '../source';
|
|
5
5
|
import { visualize } from '../util';
|
|
6
|
-
import { html, defrag } from 'typed-dom';
|
|
6
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
7
7
|
|
|
8
8
|
export const segment: HeadingParser.SegmentParser = block(validate('#', focus(
|
|
9
9
|
/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HorizontalRuleParser } from '../block';
|
|
2
2
|
import { block, line, focus } from '../../combinator';
|
|
3
|
-
import { html } from 'typed-dom';
|
|
3
|
+
import { html } from 'typed-dom/dom';
|
|
4
4
|
|
|
5
5
|
export const horizontalrule: HorizontalRuleParser = block(line(focus(
|
|
6
6
|
/^-{3,}[^\S\n]*(?:$|\n)/,
|
|
@@ -4,7 +4,7 @@ import { ulist_, fillFirstLine } from './ulist';
|
|
|
4
4
|
import { olist_ } from './olist';
|
|
5
5
|
import { inline } from '../inline';
|
|
6
6
|
import { contentline } from '../source';
|
|
7
|
-
import { html, defrag } from 'typed-dom';
|
|
7
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
8
8
|
|
|
9
9
|
export const ilist: IListParser = lazy(() => block(validate(
|
|
10
10
|
/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { undefined } from 'spica/global';
|
|
2
2
|
import { MathBlockParser } from '../block';
|
|
3
3
|
import { block, validate, fence, clear, fmap } from '../../combinator';
|
|
4
|
-
import { html } from 'typed-dom';
|
|
4
|
+
import { html } from 'typed-dom/dom';
|
|
5
5
|
|
|
6
6
|
const opener = /^(\${2,})(?!\$)([^\n]*)(?:$|\n)/;
|
|
7
7
|
|
|
@@ -5,7 +5,7 @@ import { checkbox, ulist_, fillFirstLine } from './ulist';
|
|
|
5
5
|
import { ilist_ } from './ilist';
|
|
6
6
|
import { inline, indexee, indexer } from '../inline';
|
|
7
7
|
import { contentline } from '../source';
|
|
8
|
-
import { html, define, defrag } from 'typed-dom';
|
|
8
|
+
import { html, define, defrag } from 'typed-dom/dom';
|
|
9
9
|
import { memoize } from 'spica/memoize';
|
|
10
10
|
import { shift } from 'spica/array';
|
|
11
11
|
|
|
@@ -31,17 +31,17 @@ export const olist_: OListParser = lazy(() => block(union([
|
|
|
31
31
|
memoize(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, [])),
|
|
32
32
|
])));
|
|
33
33
|
|
|
34
|
-
const list = (type: string,
|
|
34
|
+
const list = (type: string, form: string): OListParser.ListParser => fmap(
|
|
35
35
|
some(creator(union([
|
|
36
36
|
indexee(fmap(fallback(
|
|
37
37
|
inits([
|
|
38
|
-
line(open(heads[
|
|
38
|
+
line(open(heads[form], trim(subsequence([checkbox, trimStart(some(union([indexer, inline])))])), true)),
|
|
39
39
|
indent(union([ulist_, olist_, ilist_])),
|
|
40
40
|
]),
|
|
41
41
|
invalid),
|
|
42
42
|
(ns: [string, ...(HTMLElement | string)[]]) => [html('li', { 'data-marker': ns[0] }, defrag(fillFirstLine(shift(ns)[1])))]), true),
|
|
43
43
|
]))),
|
|
44
|
-
es => [format(html('ol', es), type,
|
|
44
|
+
es => [format(html('ol', es), type, form)]);
|
|
45
45
|
|
|
46
46
|
const heads = {
|
|
47
47
|
'.': focus(
|
|
@@ -107,13 +107,13 @@ function initial(type: string): RegExp {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
function format(el: HTMLOListElement, type: string,
|
|
110
|
+
function format(el: HTMLOListElement, type: string, form: string): HTMLOListElement {
|
|
111
111
|
if (el.firstElementChild?.firstElementChild?.classList.contains('checkbox')) {
|
|
112
112
|
el.setAttribute('class', 'checklist');
|
|
113
113
|
}
|
|
114
114
|
define(el, {
|
|
115
115
|
type: type || undefined,
|
|
116
|
-
'data-format':
|
|
116
|
+
'data-format': form === '.' ? undefined : 'paren',
|
|
117
117
|
'data-type': style(type) || undefined,
|
|
118
118
|
});
|
|
119
119
|
const marker = el.firstElementChild?.getAttribute('data-marker')!.match(initial(type))?.[0] ?? '';
|
|
@@ -3,7 +3,7 @@ import { union, some, block, trim, fmap } from '../../combinator';
|
|
|
3
3
|
import { inline } from '../inline';
|
|
4
4
|
import { localize } from '../locale';
|
|
5
5
|
import { visualize } from '../util';
|
|
6
|
-
import { html, defrag } from 'typed-dom';
|
|
6
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
7
7
|
|
|
8
8
|
export const paragraph: ParagraphParser = block(localize(fmap(
|
|
9
9
|
trim(visualize(some(union([inline])))),
|
|
@@ -2,7 +2,7 @@ import { ReplyParser } from '../../block';
|
|
|
2
2
|
import { union, tails, line, validate, focus, creator, reverse, fmap } from '../../../combinator';
|
|
3
3
|
import { anchor } from '../../inline/autolink/anchor';
|
|
4
4
|
import { str } from '../../source';
|
|
5
|
-
import { html, define, defrag } from 'typed-dom';
|
|
5
|
+
import { html, define, defrag } from 'typed-dom/dom';
|
|
6
6
|
|
|
7
7
|
export const cite: ReplyParser.CiteParser = creator(line(fmap(validate(
|
|
8
8
|
'>>',
|
|
@@ -4,7 +4,7 @@ import { union, some, block, line, validate, rewrite, creator, lazy, fmap } from
|
|
|
4
4
|
import { math } from '../../inline/math';
|
|
5
5
|
import { str, anyline } from '../../source';
|
|
6
6
|
import { autolink } from '../../autolink';
|
|
7
|
-
import { html, defrag } from 'typed-dom';
|
|
7
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
8
8
|
|
|
9
9
|
export const syntax = /^>+(?=[^\S\n])|^>(?=[^\s>])|^>+(?=[^\s>])(?![0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:]))/;
|
|
10
10
|
|
|
@@ -6,7 +6,7 @@ import { inline } from '../inline';
|
|
|
6
6
|
import { anyline } from '../source';
|
|
7
7
|
import { localize } from '../locale';
|
|
8
8
|
import { visualize } from '../util';
|
|
9
|
-
import { html, defrag } from 'typed-dom';
|
|
9
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
10
10
|
import { push, pop } from 'spica/array';
|
|
11
11
|
|
|
12
12
|
/*
|
|
@@ -2,7 +2,7 @@ import { TableParser } from '../block';
|
|
|
2
2
|
import { union, sequence, some, block, line, validate, focus, rewrite, creator, surround, open, fallback, lazy, fmap } from '../../combinator';
|
|
3
3
|
import { inline } from '../inline';
|
|
4
4
|
import { contentline } from '../source';
|
|
5
|
-
import { html, defrag } from 'typed-dom';
|
|
5
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
6
6
|
import { push } from 'spica/array';
|
|
7
7
|
|
|
8
8
|
import RowParser = TableParser.RowParser;
|
|
@@ -3,7 +3,7 @@ import { union, inits, subsequence, some, block, line, validate, indent, focus,
|
|
|
3
3
|
import { olist_ } from './olist';
|
|
4
4
|
import { ilist_ } from './ilist';
|
|
5
5
|
import { inline, indexer, indexee } from '../inline';
|
|
6
|
-
import { html, defrag } from 'typed-dom';
|
|
6
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
7
7
|
import { unshift } from 'spica/array';
|
|
8
8
|
import { contentline } from '../source';
|
|
9
9
|
|
package/src/parser/block.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { mathblock } from './block/mathblock';
|
|
|
15
15
|
import { extension } from './block/extension';
|
|
16
16
|
import { reply } from './block/reply';
|
|
17
17
|
import { paragraph } from './block/paragraph';
|
|
18
|
-
import { html } from 'typed-dom';
|
|
18
|
+
import { html } from 'typed-dom/dom';
|
|
19
19
|
import { rnd0Z } from 'spica/random';
|
|
20
20
|
|
|
21
21
|
export import BlockParser = MarkdownParser.BlockParser;
|
package/src/parser/header.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { union, inits, some, block, line, validate, focus, rewrite, guard, clear
|
|
|
3
3
|
import { segment } from './segment';
|
|
4
4
|
import { str } from './source';
|
|
5
5
|
import { normalize } from './api/normalize';
|
|
6
|
-
import { html, defrag } from 'typed-dom';
|
|
6
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
7
7
|
|
|
8
8
|
export const header: MarkdownParser.HeaderParser = lazy(() => validate(
|
|
9
9
|
/^---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/,
|
|
@@ -3,7 +3,7 @@ import { AnnotationParser } from '../inline';
|
|
|
3
3
|
import { union, some, validate, guard, context, creator, surround, lazy, fmap } from '../../combinator';
|
|
4
4
|
import { inline } from '../inline';
|
|
5
5
|
import { startLoose, trimSpaceStart, trimNodeEnd } from '../util';
|
|
6
|
-
import { html, defrag } from 'typed-dom';
|
|
6
|
+
import { html, defrag } from 'typed-dom/dom';
|
|
7
7
|
|
|
8
8
|
export const annotation: AnnotationParser = lazy(() => creator(validate('((', '))', '\n', fmap(surround(
|
|
9
9
|
'((',
|