securemark 0.276.5 → 0.278.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 +9 -0
- package/README.md +12 -12
- package/design.md +4 -0
- package/dist/index.js +85 -48
- package/markdown.d.ts +25 -8
- package/package.json +1 -1
- package/src/parser/api/parse.test.ts +2 -2
- package/src/parser/block/dlist.test.ts +1 -1
- package/src/parser/block/extension/fig.test.ts +1 -1
- package/src/parser/block/heading.test.ts +2 -2
- package/src/parser/block/paragraph.test.ts +12 -9
- package/src/parser/inline/autolink/account.test.ts +3 -1
- package/src/parser/inline/autolink/account.ts +2 -2
- package/src/parser/inline/autolink/email.test.ts +0 -3
- package/src/parser/inline/autolink/email.ts +1 -1
- package/src/parser/inline/autolink/hashnum.test.ts +4 -4
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.test.ts +8 -7
- package/src/parser/inline/autolink/hashtag.ts +2 -2
- package/src/parser/inline/autolink.ts +6 -13
- package/src/parser/inline/deletion.test.ts +2 -2
- package/src/parser/inline/emphasis.test.ts +35 -26
- package/src/parser/inline/emphasis.ts +11 -4
- package/src/parser/inline/emstrong.ts +62 -0
- package/src/parser/inline/extension/index.test.ts +6 -6
- package/src/parser/inline/extension/indexee.ts +5 -5
- package/src/parser/inline/extension/placeholder.test.ts +4 -4
- package/src/parser/inline/insertion.test.ts +2 -2
- package/src/parser/inline/link.test.ts +1 -1
- package/src/parser/inline/link.ts +2 -2
- package/src/parser/inline/mark.test.ts +1 -1
- package/src/parser/inline/{comment.test.ts → remark.test.ts} +26 -26
- package/src/parser/inline/{comment.ts → remark.ts} +3 -3
- package/src/parser/inline/strong.test.ts +32 -25
- package/src/parser/inline/strong.ts +8 -4
- package/src/parser/inline.test.ts +102 -22
- package/src/parser/inline.ts +6 -3
- package/src/parser/processor/figure.ts +3 -2
- package/src/parser/processor/note.ts +4 -3
- package/src/parser/source/text.test.ts +0 -1
- package/src/parser/source/text.ts +0 -1
- package/src/renderer/render/media/twitter.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ Secure markdown renderer working on browsers for user input data.
|
|
|
47
47
|
- Blockquote (>, !>)
|
|
48
48
|
- Preformattedtext (```)
|
|
49
49
|
- Pagebreak (===)
|
|
50
|
-
- Inline markups (
|
|
50
|
+
- Inline markups (*, **, `, []{}, {}, ![]{}, !{}, \[](), ++, ~~, (()), ...)
|
|
51
51
|
- Inline HTML tags (\<bdi>, \<bdo>)
|
|
52
52
|
- Autolink (https://host, user@host, @user)
|
|
53
53
|
- Shortmedia (!https://host/image.png, !https://youtu.be/...)
|
|
@@ -61,20 +61,20 @@ Secure markdown renderer working on browsers for user input data.
|
|
|
61
61
|
- Channel (@user#tag)
|
|
62
62
|
- Hashtag (#tag)
|
|
63
63
|
- Template ({{ template }})
|
|
64
|
-
-
|
|
64
|
+
- Remark ([% remark %])
|
|
65
65
|
|
|
66
66
|
## Operator precedence
|
|
67
67
|
|
|
68
|
-
|P| Operators
|
|
69
|
-
|
|
70
|
-
|9| \n, \\\n
|
|
71
|
-
|8| `
|
|
72
|
-
|6| (()), [[]], ${}$
|
|
73
|
-
|5| \<tag>\</tag>
|
|
74
|
-
|4| [% %]
|
|
75
|
-
|3| $, "
|
|
76
|
-
|2| (), [], {}
|
|
77
|
-
|1|
|
|
68
|
+
|P| Operators |
|
|
69
|
+
|-|-------------------|
|
|
70
|
+
|9| \n, \\\n |
|
|
71
|
+
|8| ` |
|
|
72
|
+
|6| (()), [[]], ${}$ |
|
|
73
|
+
|5| \<tag>\</tag> |
|
|
74
|
+
|4| [% %] |
|
|
75
|
+
|3| $, " |
|
|
76
|
+
|2| (), [], {} |
|
|
77
|
+
|1| *, **, ==, ++, ~~ |
|
|
78
78
|
|
|
79
79
|
## Dependencies
|
|
80
80
|
|
package/design.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.278.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -5761,7 +5761,7 @@ const combinator_1 = __webpack_require__(2087);
|
|
|
5761
5761
|
const annotation_1 = __webpack_require__(2736);
|
|
5762
5762
|
const reference_1 = __webpack_require__(3555);
|
|
5763
5763
|
const template_1 = __webpack_require__(4695);
|
|
5764
|
-
const
|
|
5764
|
+
const remark_1 = __webpack_require__(3217);
|
|
5765
5765
|
const math_1 = __webpack_require__(8946);
|
|
5766
5766
|
const extension_1 = __webpack_require__(8053);
|
|
5767
5767
|
const ruby_1 = __webpack_require__(6705);
|
|
@@ -5770,6 +5770,7 @@ const html_1 = __webpack_require__(5994);
|
|
|
5770
5770
|
const insertion_1 = __webpack_require__(2945);
|
|
5771
5771
|
const deletion_1 = __webpack_require__(7501);
|
|
5772
5772
|
const mark_1 = __webpack_require__(2480);
|
|
5773
|
+
const emstrong_1 = __webpack_require__(6132);
|
|
5773
5774
|
const emphasis_1 = __webpack_require__(3867);
|
|
5774
5775
|
const strong_1 = __webpack_require__(6578);
|
|
5775
5776
|
const code_1 = __webpack_require__(5771);
|
|
@@ -5779,7 +5780,7 @@ const shortmedia_1 = __webpack_require__(4189);
|
|
|
5779
5780
|
const autolink_1 = __webpack_require__(6051);
|
|
5780
5781
|
const bracket_1 = __webpack_require__(5196);
|
|
5781
5782
|
const source_1 = __webpack_require__(6743);
|
|
5782
|
-
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template,
|
|
5783
|
+
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template, remark_1.remark, math_1.math, extension_1.extension, ruby_1.ruby, link_1.textlink, link_1.linemedialink, media_1.linemedia, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, emstrong_1.emstrong, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.lineshortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]));
|
|
5783
5784
|
var indexee_1 = __webpack_require__(1269);
|
|
5784
5785
|
Object.defineProperty(exports, "indexee", ({
|
|
5785
5786
|
enumerable: true,
|
|
@@ -5851,22 +5852,15 @@ const hashnum_1 = __webpack_require__(5631);
|
|
|
5851
5852
|
const anchor_1 = __webpack_require__(6495);
|
|
5852
5853
|
const source_1 = __webpack_require__(6743);
|
|
5853
5854
|
const util_1 = __webpack_require__(9437);
|
|
5854
|
-
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/
|
|
5855
|
+
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/iu, (0, combinator_1.constraint)(2 /* State.autolink */, false, (0, combinator_1.syntax)(2 /* Syntax.autolink */, 1, 1, ~1 /* State.shortcut */, (0, combinator_1.union)([(0, combinator_1.some)((0, combinator_1.union)([url_1.lineurl])), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email,
|
|
5855
5856
|
// Escape unmatched email-like strings.
|
|
5856
|
-
(0,
|
|
5857
|
-
source
|
|
5858
|
-
}) => {
|
|
5859
|
-
if (source.length > 255 || source.includes('@')) return [[source], ''];
|
|
5860
|
-
const i = source.indexOf('_');
|
|
5861
|
-
if (i === -1) return [[source], ''];
|
|
5862
|
-
return [[source.slice(0, i)], source.slice(i)];
|
|
5863
|
-
}), channel_1.channel, account_1.account,
|
|
5857
|
+
(0, source_1.str)(/^[0-9a-z]+(?:[_.+-][0-9a-z]+)*(?:@(?:[0-9a-z]+(?:[.-][0-9a-z]+)*)?)*/i), channel_1.channel, account_1.account,
|
|
5864
5858
|
// Escape unmatched account-like strings.
|
|
5865
|
-
(0, source_1.str)(/^@+[0-9a-z]*(
|
|
5859
|
+
(0, source_1.str)(/^@+[0-9a-z]*(?:[-.][0-9a-z]+)*/i),
|
|
5866
5860
|
// Escape invalid leading characters.
|
|
5867
|
-
(0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji)(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum,
|
|
5861
|
+
(0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum,
|
|
5868
5862
|
// Escape unmatched hashtag-like strings.
|
|
5869
|
-
(0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|')*/u.source.replace('emoji', hashtag_1.emoji), 'u')),
|
|
5863
|
+
(0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])*/u.source.replace('emoji', hashtag_1.emoji), 'u')),
|
|
5870
5864
|
// Escape invalid leading characters.
|
|
5871
5865
|
(0, source_1.str)(/^[0-9\p{Sc}](?=>)/u), anchor_1.anchor])), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)])])))));
|
|
5872
5866
|
|
|
@@ -5887,7 +5881,7 @@ const link_1 = __webpack_require__(9628);
|
|
|
5887
5881
|
const source_1 = __webpack_require__(6743);
|
|
5888
5882
|
const dom_1 = __webpack_require__(3252);
|
|
5889
5883
|
// https://example/@user must be a user page or a redirect page going there.
|
|
5890
|
-
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1 /* State.shortcut */, false, (0, combinator_1.open)('@', (0, combinator_1.tails)([(0, source_1.str)(/^[0-9a-z](?:(?:[0-9a-z]|-(
|
|
5884
|
+
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1 /* State.shortcut */, false, (0, combinator_1.open)('@', (0, combinator_1.tails)([(0, source_1.str)(/^[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//i), (0, source_1.str)(/^[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*/i)]))), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
|
|
5891
5885
|
class: 'account'
|
|
5892
5886
|
})]));
|
|
5893
5887
|
|
|
@@ -5961,7 +5955,7 @@ const combinator_1 = __webpack_require__(2087);
|
|
|
5961
5955
|
const source_1 = __webpack_require__(6743);
|
|
5962
5956
|
const dom_1 = __webpack_require__(3252);
|
|
5963
5957
|
// https://html.spec.whatwg.org/multipage/input.html
|
|
5964
|
-
exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(
|
|
5958
|
+
exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z])/i), ([source]) => source.length <= 255), ({
|
|
5965
5959
|
source
|
|
5966
5960
|
}) => [[(0, dom_1.html)('a', {
|
|
5967
5961
|
class: 'email',
|
|
@@ -5985,7 +5979,7 @@ const link_1 = __webpack_require__(9628);
|
|
|
5985
5979
|
const hashtag_1 = __webpack_require__(5491);
|
|
5986
5980
|
const source_1 = __webpack_require__(6743);
|
|
5987
5981
|
const dom_1 = __webpack_require__(3252);
|
|
5988
|
-
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1 /* State.shortcut */, false, (0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,
|
|
5982
|
+
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1 /* State.shortcut */, false, (0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,9}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u')))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
|
|
5989
5983
|
class: 'hashnum',
|
|
5990
5984
|
href: null
|
|
5991
5985
|
})]));
|
|
@@ -6009,7 +6003,7 @@ const dom_1 = __webpack_require__(3252);
|
|
|
6009
6003
|
// https://example/hashtags/a must be a hashtag page or a redirect page going there.
|
|
6010
6004
|
// https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
|
|
6011
6005
|
exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
|
|
6012
|
-
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1 /* State.shortcut */, false, (0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^(?=(?:[0-9]{1,
|
|
6006
|
+
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1 /* State.shortcut */, false, (0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^(?!['_])(?=(?:[0-9]{1,9})?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji|'|_(?=[^\p{C}\p{S}\p{P}\s]|emoji|')))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|'|_(?=[^\p{C}\p{S}\p{P}\s]|emoji|'))+/u.source].join('').replace(/emoji/g, exports.emoji), 'u')))), (0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
|
|
6013
6007
|
class: 'hashtag'
|
|
6014
6008
|
})]));
|
|
6015
6009
|
|
|
@@ -6084,7 +6078,7 @@ function format(text) {
|
|
|
6084
6078
|
|
|
6085
6079
|
/***/ }),
|
|
6086
6080
|
|
|
6087
|
-
/***/
|
|
6081
|
+
/***/ 7501:
|
|
6088
6082
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6089
6083
|
|
|
6090
6084
|
"use strict";
|
|
@@ -6093,22 +6087,18 @@ function format(text) {
|
|
|
6093
6087
|
Object.defineProperty(exports, "__esModule", ({
|
|
6094
6088
|
value: true
|
|
6095
6089
|
}));
|
|
6096
|
-
exports.
|
|
6090
|
+
exports.deletion = void 0;
|
|
6097
6091
|
const combinator_1 = __webpack_require__(2087);
|
|
6098
6092
|
const inline_1 = __webpack_require__(1160);
|
|
6099
6093
|
const source_1 = __webpack_require__(6743);
|
|
6100
|
-
const
|
|
6094
|
+
const visibility_1 = __webpack_require__(7618);
|
|
6101
6095
|
const array_1 = __webpack_require__(8112);
|
|
6102
6096
|
const dom_1 = __webpack_require__(3252);
|
|
6103
|
-
exports.
|
|
6104
|
-
class: 'comment'
|
|
6105
|
-
}, [(0, dom_1.html)('input', {
|
|
6106
|
-
type: 'checkbox'
|
|
6107
|
-
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, [])))));
|
|
6097
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~', '~'), (0, combinator_1.syntax)(0 /* Syntax.none */, 1, 1, 0 /* State.none */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6108
6098
|
|
|
6109
6099
|
/***/ }),
|
|
6110
6100
|
|
|
6111
|
-
/***/
|
|
6101
|
+
/***/ 3867:
|
|
6112
6102
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6113
6103
|
|
|
6114
6104
|
"use strict";
|
|
@@ -6117,18 +6107,20 @@ exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%',
|
|
|
6117
6107
|
Object.defineProperty(exports, "__esModule", ({
|
|
6118
6108
|
value: true
|
|
6119
6109
|
}));
|
|
6120
|
-
exports.
|
|
6110
|
+
exports.emphasis = void 0;
|
|
6121
6111
|
const combinator_1 = __webpack_require__(2087);
|
|
6122
6112
|
const inline_1 = __webpack_require__(1160);
|
|
6113
|
+
const emstrong_1 = __webpack_require__(6132);
|
|
6114
|
+
const strong_1 = __webpack_require__(6578);
|
|
6123
6115
|
const source_1 = __webpack_require__(6743);
|
|
6124
6116
|
const visibility_1 = __webpack_require__(7618);
|
|
6125
6117
|
const array_1 = __webpack_require__(8112);
|
|
6126
6118
|
const dom_1 = __webpack_require__(3252);
|
|
6127
|
-
exports.
|
|
6119
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', '*'), (0, combinator_1.syntax)(0 /* Syntax.none */, 1, 1, 0 /* State.none */, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*'), [[/^\\?\n/, 9]]), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*', [[/^\\?\n/, 9]]), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])))), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6128
6120
|
|
|
6129
6121
|
/***/ }),
|
|
6130
6122
|
|
|
6131
|
-
/***/
|
|
6123
|
+
/***/ 6132:
|
|
6132
6124
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6133
6125
|
|
|
6134
6126
|
"use strict";
|
|
@@ -6137,14 +6129,33 @@ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
|
|
|
6137
6129
|
Object.defineProperty(exports, "__esModule", ({
|
|
6138
6130
|
value: true
|
|
6139
6131
|
}));
|
|
6140
|
-
exports.
|
|
6132
|
+
exports.emstrong = void 0;
|
|
6141
6133
|
const combinator_1 = __webpack_require__(2087);
|
|
6142
6134
|
const inline_1 = __webpack_require__(1160);
|
|
6135
|
+
const strong_1 = __webpack_require__(6578);
|
|
6136
|
+
const emphasis_1 = __webpack_require__(3867);
|
|
6143
6137
|
const source_1 = __webpack_require__(6743);
|
|
6144
6138
|
const visibility_1 = __webpack_require__(7618);
|
|
6145
|
-
const array_1 = __webpack_require__(8112);
|
|
6146
6139
|
const dom_1 = __webpack_require__(3252);
|
|
6147
|
-
|
|
6140
|
+
const array_1 = __webpack_require__(8112);
|
|
6141
|
+
const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**'), [[/^\\?\n/, 9]]), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*', [[/^\\?\n/, 9]]), (0, combinator_1.union)([exports.emstrong, strong_1.strong]))])));
|
|
6142
|
+
const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*'), [[/^\\?\n/, 9]]), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*', [[/^\\?\n/, 9]]), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
|
|
6143
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('***'), (0, combinator_1.syntax)(0 /* Syntax.none */, 1, 1, 0 /* State.none */, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*'), [[/^\\?\n/, 9]]), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*', [[/^\\?\n/, 9]]), inline_1.inline)])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
|
|
6144
|
+
switch (cs[0]) {
|
|
6145
|
+
case '***':
|
|
6146
|
+
return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
|
|
6147
|
+
case '**':
|
|
6148
|
+
return (0, combinator_1.bind)(subemphasis, (ds, rest) => rest.slice(0, 1) === '*' ? [[(0, dom_1.html)('em', (0, array_1.unshift)([(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(1)] : [(0, array_1.unshift)(['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], ds), rest])({
|
|
6149
|
+
source: rest,
|
|
6150
|
+
context
|
|
6151
|
+
}) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest];
|
|
6152
|
+
case '*':
|
|
6153
|
+
return (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' ? [[(0, dom_1.html)('strong', (0, array_1.unshift)([(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(2)] : [(0, array_1.unshift)(['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], ds), rest])({
|
|
6154
|
+
source: rest,
|
|
6155
|
+
context
|
|
6156
|
+
}) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
|
|
6157
|
+
}
|
|
6158
|
+
}, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6148
6159
|
|
|
6149
6160
|
/***/ }),
|
|
6150
6161
|
|
|
@@ -6242,7 +6253,7 @@ function index(source, optional = false) {
|
|
|
6242
6253
|
exports.index = index;
|
|
6243
6254
|
function signature(source) {
|
|
6244
6255
|
const target = source.cloneNode(true);
|
|
6245
|
-
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .label[data-label], .
|
|
6256
|
+
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .label[data-label], .remark, rt, rp, br, .annotation, .reference, .checkbox, ul, ol'), len = es.length, i = 0; i < len; ++i) {
|
|
6246
6257
|
const el = es[i];
|
|
6247
6258
|
switch (el.tagName) {
|
|
6248
6259
|
case 'CODE':
|
|
@@ -6263,7 +6274,7 @@ function signature(source) {
|
|
|
6263
6274
|
case 'label':
|
|
6264
6275
|
el.replaceWith(`[$${el.getAttribute('data-label').replace('$', '')}]`);
|
|
6265
6276
|
continue;
|
|
6266
|
-
case '
|
|
6277
|
+
case 'remark':
|
|
6267
6278
|
case 'checkbox':
|
|
6268
6279
|
case 'annotation':
|
|
6269
6280
|
case 'reference':
|
|
@@ -6276,7 +6287,7 @@ function signature(source) {
|
|
|
6276
6287
|
exports.signature = signature;
|
|
6277
6288
|
exports.text = (0, memoize_1.reduce)(source => {
|
|
6278
6289
|
const target = source.cloneNode(true);
|
|
6279
|
-
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .
|
|
6290
|
+
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .remark, rt, rp, br, .annotation, .reference, .checkbox, ul, ol'), len = es.length, i = 0; i < len; ++i) {
|
|
6280
6291
|
const el = es[i];
|
|
6281
6292
|
switch (el.tagName) {
|
|
6282
6293
|
case 'CODE':
|
|
@@ -6294,7 +6305,7 @@ exports.text = (0, memoize_1.reduce)(source => {
|
|
|
6294
6305
|
case 'math':
|
|
6295
6306
|
el.replaceWith(el.getAttribute('data-src'));
|
|
6296
6307
|
continue;
|
|
6297
|
-
case '
|
|
6308
|
+
case 'remark':
|
|
6298
6309
|
case 'checkbox':
|
|
6299
6310
|
case 'annotation':
|
|
6300
6311
|
case 'reference':
|
|
@@ -6620,10 +6631,10 @@ function resolve(uri, host, source) {
|
|
|
6620
6631
|
exports.resolve = resolve;
|
|
6621
6632
|
function decode(uri) {
|
|
6622
6633
|
if (!uri.includes('%')) return uri;
|
|
6623
|
-
const origin = uri.match(/^[a-z](?:[-.](
|
|
6634
|
+
const origin = uri.match(/^[a-z](?:[-.](?=[0-9a-z])|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i)?.[0] ?? '';
|
|
6624
6635
|
try {
|
|
6625
6636
|
let path = decodeURI(uri.slice(origin.length));
|
|
6626
|
-
if (!origin && /^[a-z](?:[-.](
|
|
6637
|
+
if (!origin && /^[a-z](?:[-.](?=[0-9a-z])|[0-9a-z])*:\/{0,2}\S/i.test(path)) {
|
|
6627
6638
|
path = uri.slice(origin.length);
|
|
6628
6639
|
}
|
|
6629
6640
|
uri = origin + path;
|
|
@@ -6826,6 +6837,30 @@ function attributes(ns) {
|
|
|
6826
6837
|
|
|
6827
6838
|
/***/ }),
|
|
6828
6839
|
|
|
6840
|
+
/***/ 3217:
|
|
6841
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6842
|
+
|
|
6843
|
+
"use strict";
|
|
6844
|
+
|
|
6845
|
+
|
|
6846
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
6847
|
+
value: true
|
|
6848
|
+
}));
|
|
6849
|
+
exports.remark = void 0;
|
|
6850
|
+
const combinator_1 = __webpack_require__(2087);
|
|
6851
|
+
const inline_1 = __webpack_require__(1160);
|
|
6852
|
+
const source_1 = __webpack_require__(6743);
|
|
6853
|
+
const memoize_1 = __webpack_require__(1808);
|
|
6854
|
+
const array_1 = __webpack_require__(8112);
|
|
6855
|
+
const dom_1 = __webpack_require__(3252);
|
|
6856
|
+
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0 /* Syntax.none */, 4, 1, 0 /* State.none */, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
6857
|
+
class: 'remark'
|
|
6858
|
+
}, [(0, dom_1.html)('input', {
|
|
6859
|
+
type: 'checkbox'
|
|
6860
|
+
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, [])))));
|
|
6861
|
+
|
|
6862
|
+
/***/ }),
|
|
6863
|
+
|
|
6829
6864
|
/***/ 6705:
|
|
6830
6865
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6831
6866
|
|
|
@@ -6951,11 +6986,12 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6951
6986
|
exports.strong = void 0;
|
|
6952
6987
|
const combinator_1 = __webpack_require__(2087);
|
|
6953
6988
|
const inline_1 = __webpack_require__(1160);
|
|
6989
|
+
const emstrong_1 = __webpack_require__(6132);
|
|
6954
6990
|
const source_1 = __webpack_require__(6743);
|
|
6955
6991
|
const visibility_1 = __webpack_require__(7618);
|
|
6956
6992
|
const array_1 = __webpack_require__(8112);
|
|
6957
6993
|
const dom_1 = __webpack_require__(3252);
|
|
6958
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('
|
|
6994
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', '*'), (0, combinator_1.syntax)(0 /* Syntax.none */, 1, 1, 0 /* State.none */, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**'), [[/^\\?\n/, 9]]), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*', [[/^\\?\n/, 9]]), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])))), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6959
6995
|
|
|
6960
6996
|
/***/ }),
|
|
6961
6997
|
|
|
@@ -7000,13 +7036,14 @@ function* figure(target, notes, opts = {}) {
|
|
|
7000
7036
|
const refs = new queue_1.MultiQueue((0, array_1.push)((0, query_1.querySelectorAll)(target, 'a.label:not(.disabled)[data-label]'), notes && (0, query_1.querySelectorAll)(notes.references, 'a.label:not(.disabled)') || []).map(el => [el.getAttribute('data-label'), el]));
|
|
7001
7037
|
const labels = new Set();
|
|
7002
7038
|
const numbers = new Map();
|
|
7039
|
+
const scope = target instanceof Element ? ':scope > ' : '';
|
|
7003
7040
|
let base = '0';
|
|
7004
7041
|
let bases = base.split('.');
|
|
7005
7042
|
let index = bases;
|
|
7006
|
-
for (let defs = target.querySelectorAll(
|
|
7043
|
+
for (let defs = target.querySelectorAll(`${scope}:is(figure[data-label], h1, h2)`), len = defs.length, i = 0; i < len; ++i) {
|
|
7007
7044
|
yield;
|
|
7008
7045
|
const def = defs[i];
|
|
7009
|
-
if (def.parentNode !== target) continue;
|
|
7046
|
+
if (!scope && def.parentNode !== target) continue;
|
|
7010
7047
|
const {
|
|
7011
7048
|
tagName
|
|
7012
7049
|
} = def;
|
|
@@ -7163,7 +7200,8 @@ function build(syntax, marker, splitter = '') {
|
|
|
7163
7200
|
const defIndexes = new Map();
|
|
7164
7201
|
const refSubindexes = new Map();
|
|
7165
7202
|
const defSubindexes = new Map();
|
|
7166
|
-
const
|
|
7203
|
+
const scope = target instanceof Element ? ':scope > ' : '';
|
|
7204
|
+
const splitters = splitter ? target.querySelectorAll(`${scope}:is(${splitter})`) : [];
|
|
7167
7205
|
let iSplitters = 0;
|
|
7168
7206
|
let total = 0;
|
|
7169
7207
|
let format;
|
|
@@ -7176,7 +7214,7 @@ function build(syntax, marker, splitter = '') {
|
|
|
7176
7214
|
}
|
|
7177
7215
|
if (splitter) for (let el; el = splitters[iSplitters], el?.compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING; ++iSplitters) {
|
|
7178
7216
|
if (~iSplitters << 32 - 8 === 0) yield;
|
|
7179
|
-
if (el.parentNode !== target) continue;
|
|
7217
|
+
if (!scope && el.parentNode !== target) continue;
|
|
7180
7218
|
if (el.tagName === 'OL' && el.nextElementSibling !== splitters[iSplitters + 1]) {
|
|
7181
7219
|
el.remove();
|
|
7182
7220
|
continue;
|
|
@@ -7248,7 +7286,7 @@ function build(syntax, marker, splitter = '') {
|
|
|
7248
7286
|
}
|
|
7249
7287
|
if (splitter) for (let el; el = splitters[iSplitters]; ++iSplitters) {
|
|
7250
7288
|
if (~iSplitters << 32 - 8 === 0) yield;
|
|
7251
|
-
if (el.parentNode !== target) continue;
|
|
7289
|
+
if (!scope && el.parentNode !== target) continue;
|
|
7252
7290
|
if (el.tagName === 'OL') {
|
|
7253
7291
|
el.remove();
|
|
7254
7292
|
}
|
|
@@ -7565,7 +7603,6 @@ exports.text = (0, combinator_1.creation)(1, false, ({
|
|
|
7565
7603
|
}
|
|
7566
7604
|
case '\n':
|
|
7567
7605
|
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
7568
|
-
case '_':
|
|
7569
7606
|
case '*':
|
|
7570
7607
|
case '+':
|
|
7571
7608
|
case '~':
|
|
@@ -8120,7 +8157,7 @@ const origins = ['https://twitter.com'];
|
|
|
8120
8157
|
function twitter(source, url) {
|
|
8121
8158
|
if (!origins.includes(url.origin)) return;
|
|
8122
8159
|
if (url.pathname.split('/').pop().includes('.')) return;
|
|
8123
|
-
if (!url.pathname.match(/^\/\w+\/status\/[0-9]{15,}
|
|
8160
|
+
if (!url.pathname.match(/^\/\w+\/status\/[0-9]{15,}\/?$/)) return;
|
|
8124
8161
|
const el = (0, dom_1.html)('div', {
|
|
8125
8162
|
class: source.className,
|
|
8126
8163
|
'data-type': 'twitter'
|
package/markdown.d.ts
CHANGED
|
@@ -636,7 +636,7 @@ export namespace MarkdownParser {
|
|
|
636
636
|
InlineParser.AnnotationParser,
|
|
637
637
|
InlineParser.ReferenceParser,
|
|
638
638
|
InlineParser.TemplateParser,
|
|
639
|
-
InlineParser.
|
|
639
|
+
InlineParser.RemarkParser,
|
|
640
640
|
InlineParser.MathParser,
|
|
641
641
|
InlineParser.ExtensionParser,
|
|
642
642
|
InlineParser.RubyParser,
|
|
@@ -647,6 +647,7 @@ export namespace MarkdownParser {
|
|
|
647
647
|
InlineParser.InsertionParser,
|
|
648
648
|
InlineParser.DeletionParser,
|
|
649
649
|
InlineParser.MarkParser,
|
|
650
|
+
InlineParser.EmStrongParser,
|
|
650
651
|
InlineParser.StrongParser,
|
|
651
652
|
InlineParser.EmphasisParser,
|
|
652
653
|
InlineParser.CodeParser,
|
|
@@ -714,9 +715,9 @@ export namespace MarkdownParser {
|
|
|
714
715
|
]> {
|
|
715
716
|
}
|
|
716
717
|
}
|
|
717
|
-
export interface
|
|
718
|
-
// [%
|
|
719
|
-
Inline<'
|
|
718
|
+
export interface RemarkParser extends
|
|
719
|
+
// [% remark %]
|
|
720
|
+
Inline<'remark'>,
|
|
720
721
|
Parser<HTMLElement | string, Context, [
|
|
721
722
|
InlineParser,
|
|
722
723
|
]> {
|
|
@@ -1043,20 +1044,36 @@ export namespace MarkdownParser {
|
|
|
1043
1044
|
MarkParser,
|
|
1044
1045
|
]> {
|
|
1045
1046
|
}
|
|
1047
|
+
export interface EmStrongParser extends
|
|
1048
|
+
// ***abc***
|
|
1049
|
+
Inline<'emstrong'>,
|
|
1050
|
+
Parser<HTMLElement | string, Context, [
|
|
1051
|
+
InlineParser,
|
|
1052
|
+
InlineParser,
|
|
1053
|
+
]> {
|
|
1054
|
+
}
|
|
1046
1055
|
export interface StrongParser extends
|
|
1047
|
-
//
|
|
1056
|
+
// **abc**
|
|
1048
1057
|
Inline<'strong'>,
|
|
1049
1058
|
Parser<HTMLElement | string, Context, [
|
|
1050
1059
|
InlineParser,
|
|
1051
|
-
|
|
1060
|
+
Parser<HTMLElement | string, Context, [
|
|
1061
|
+
EmStrongParser,
|
|
1062
|
+
StrongParser,
|
|
1063
|
+
]>,
|
|
1052
1064
|
]> {
|
|
1053
1065
|
}
|
|
1054
1066
|
export interface EmphasisParser extends
|
|
1055
|
-
//
|
|
1067
|
+
// *abc*
|
|
1056
1068
|
Inline<'emphasis'>,
|
|
1057
1069
|
Parser<HTMLElement | string, Context, [
|
|
1070
|
+
StrongParser,
|
|
1058
1071
|
InlineParser,
|
|
1059
|
-
|
|
1072
|
+
Parser<HTMLElement | string, Context, [
|
|
1073
|
+
EmStrongParser,
|
|
1074
|
+
StrongParser,
|
|
1075
|
+
EmphasisParser,
|
|
1076
|
+
]>,
|
|
1060
1077
|
]> {
|
|
1061
1078
|
}
|
|
1062
1079
|
export interface CodeParser extends
|
package/package.json
CHANGED
|
@@ -53,10 +53,10 @@ describe('Unit: parser/api/parse', () => {
|
|
|
53
53
|
['<p><wbr><br>a</p>']);
|
|
54
54
|
assert.deepStrictEqual(
|
|
55
55
|
[...parse('[%\n<wbr>\n%]').children].map(el => el.outerHTML),
|
|
56
|
-
['<p><span class="
|
|
56
|
+
['<p><span class="remark"><input type="checkbox"><span>[%<br><wbr><br>%]</span></span></p>']);
|
|
57
57
|
assert.deepStrictEqual(
|
|
58
58
|
[...parse('[%\n<wbr>\n%]\na').children].map(el => el.outerHTML),
|
|
59
|
-
['<p><span class="
|
|
59
|
+
['<p><span class="remark"><input type="checkbox"><span>[%<br><wbr><br>%]</span></span><br>a</p>']);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it('linebreak', () => {
|
|
@@ -68,7 +68,7 @@ describe('Unit: parser/block/dlist', () => {
|
|
|
68
68
|
assert.deepStrictEqual(inspect(parser('~ a [|b]')), [['<dl><dt id="index::b">a<span class="indexer" data-index="b"></span></dt><dd></dd></dl>'], '']);
|
|
69
69
|
assert.deepStrictEqual(inspect(parser('~ a [|b]\\')), [['<dl><dt id="index::a_b">a <span class="invalid">b</span></dt><dd></dd></dl>'], '']);
|
|
70
70
|
assert.deepStrictEqual(inspect(parser('~ A')), [['<dl><dt id="index::A">A</dt><dd></dd></dl>'], '']);
|
|
71
|
-
assert.deepStrictEqual(inspect(parser('~
|
|
71
|
+
assert.deepStrictEqual(inspect(parser('~ *A*')), [['<dl><dt id="index::A"><em>A</em></dt><dd></dd></dl>'], '']);
|
|
72
72
|
assert.deepStrictEqual(inspect(parser('~ `A`')), [['<dl><dt id="index::`A`"><code data-src="`A`">A</code></dt><dd></dd></dl>'], '']);
|
|
73
73
|
assert.deepStrictEqual(inspect(parser('~ ${A}$')), [['<dl><dt id="index::${A}$"><span class="math" translate="no" data-src="${A}$">${A}$</span></dt><dd></dd></dl>'], '']);
|
|
74
74
|
});
|
|
@@ -39,7 +39,7 @@ describe('Unit: parser/block/extension/fig', () => {
|
|
|
39
39
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n> ')), [['<figure data-type="quote" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><blockquote></blockquote></div></figure>'], '']);
|
|
40
40
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n> \n')), [['<figure data-type="quote" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><blockquote></blockquote></div></figure>'], '']);
|
|
41
41
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n>\n~~~')), [['<figure data-type="quote" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><blockquote><pre><br>~~~</pre></blockquote></div></figure>'], '']);
|
|
42
|
-
assert.deepStrictEqual(inspect(parser('[$group-name]\n!>
|
|
42
|
+
assert.deepStrictEqual(inspect(parser('[$group-name]\n!> *a*')), [['<figure data-type="quote" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><blockquote><section><p><em>a</em></p><h2>References</h2><ol class="references"></ol></section></blockquote></div></figure>'], '']);
|
|
43
43
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n![]{https://host}')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
44
44
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n![]{https://host}\n')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
45
45
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n!https://host\ncaption')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext">caption</span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
@@ -36,7 +36,7 @@ describe('Unit: parser/block/heading', () => {
|
|
|
36
36
|
assert.deepStrictEqual(inspect(parser('# a ')), [['<h1 id="index::a">a</h1>'], '']);
|
|
37
37
|
assert.deepStrictEqual(inspect(parser('# a b c \n')), [['<h1 id="index::a_b_c">a b c</h1>'], '']);
|
|
38
38
|
assert.deepStrictEqual(inspect(parser('# a\n')), [['<h1 id="index::a">a</h1>'], '']);
|
|
39
|
-
assert.deepStrictEqual(inspect(parser('#
|
|
39
|
+
assert.deepStrictEqual(inspect(parser('# *a*`b`${c}$')), [['<h1 id="index::a`b`${c}$"><em>a</em><code data-src="`b`">b</code><span class="math" translate="no" data-src="${c}$">${c}$</span></h1>'], '']);
|
|
40
40
|
assert.deepStrictEqual(inspect(parser('# a\\')), [['<h1 id="index::a">a</h1>'], '']);
|
|
41
41
|
assert.deepStrictEqual(inspect(parser('# a\\\n')), [['<h1 id="index::a">a</h1>'], '']);
|
|
42
42
|
assert.deepStrictEqual(inspect(parser('# \\')), [['<h1 id="index::\\">\\</h1>'], '']);
|
|
@@ -69,7 +69,7 @@ describe('Unit: parser/block/heading', () => {
|
|
|
69
69
|
assert.deepStrictEqual(inspect(parser('# a [|b ]')), [['<h1 id="index::b">a<span class="indexer" data-index="b"></span></h1>'], '']);
|
|
70
70
|
assert.deepStrictEqual(inspect(parser('# a [|b ]')), [['<h1 id="index::b">a<span class="indexer" data-index="b"></span></h1>'], '']);
|
|
71
71
|
assert.deepStrictEqual(inspect(parser('# a [|b c]')), [['<h1 id="index::b_c">a<span class="indexer" data-index="b_c"></span></h1>'], '']);
|
|
72
|
-
assert.deepStrictEqual(inspect(parser('# a [
|
|
72
|
+
assert.deepStrictEqual(inspect(parser('# a [|*b*`c`${d}$]')), [['<h1 id="index::*b*`c`${d}$">a<span class="indexer" data-index="*b*`c`${d}$"></span></h1>'], '']);
|
|
73
73
|
assert.deepStrictEqual(inspect(parser('# a [|@a]')), [['<h1 id="index::@a">a<span class="indexer" data-index="@a"></span></h1>'], '']);
|
|
74
74
|
assert.deepStrictEqual(inspect(parser('# a [|http://host]')), [['<h1 id="index::http://host">a<span class="indexer" data-index="http://host"></span></h1>'], '']);
|
|
75
75
|
assert.deepStrictEqual(inspect(parser('# a [|!http://host]')), [['<h1 id="index::!http://host">a<span class="indexer" data-index="!http://host"></span></h1>'], '']);
|
|
@@ -27,8 +27,11 @@ describe('Unit: parser/block/paragraph', () => {
|
|
|
27
27
|
assert.deepStrictEqual(inspect(parser('<wbr>\na')), [['<p><wbr><br>a</p>'], '']);
|
|
28
28
|
assert.deepStrictEqual(inspect(parser('a\n<wbr>\n')), [['<p>a<br><wbr></p>'], '']);
|
|
29
29
|
assert.deepStrictEqual(inspect(parser('a\n<wbr>\nb')), [['<p>a<br><wbr><br>b</p>'], '']);
|
|
30
|
-
assert.deepStrictEqual(inspect(parser('_a\n<wbr>_\nb')), [['<p>_a<br><wbr>_<br>b</p>'], '']);
|
|
31
30
|
assert.deepStrictEqual(inspect(parser('*a\n<wbr>*\nb')), [['<p>*a<br><wbr>*<br>b</p>'], '']);
|
|
31
|
+
assert.deepStrictEqual(inspect(parser('**a\n<wbr>**\nb')), [['<p>**a<br><wbr>**<br>b</p>'], '']);
|
|
32
|
+
assert.deepStrictEqual(inspect(parser('***a\n<wbr>***\nb')), [['<p>***a<br><wbr>***<br>b</p>'], '']);
|
|
33
|
+
assert.deepStrictEqual(inspect(parser('***a*b\n<wbr>**\nc')), [['<p>**<em>a</em>b<br><wbr>**<br>c</p>'], '']);
|
|
34
|
+
assert.deepStrictEqual(inspect(parser('***a**b\n<wbr>*\nc')), [['<p>*<strong>a</strong>b<br><wbr>*<br>c</p>'], '']);
|
|
32
35
|
assert.deepStrictEqual(inspect(parser('==a\n<wbr>==\nb')), [['<p>==a<br><wbr>==<br>b</p>'], '']);
|
|
33
36
|
assert.deepStrictEqual(inspect(parser('http://host#\\')), [['<p><a class="url" href="http://host#\\" target="_blank">http://host#\\</a></p>'], '']);
|
|
34
37
|
assert.deepStrictEqual(inspect(parser('a\nhttp://host#\\ \nb')), [['<p>a<br><a class="url" href="http://host#\\" target="_blank">http://host#\\</a><br>b</p>'], '']);
|
|
@@ -58,14 +61,14 @@ describe('Unit: parser/block/paragraph', () => {
|
|
|
58
61
|
assert.deepStrictEqual(inspect(parser('あ>>1')), [['<p>あ<a class="anchor" href="?at=1">>>1</a></p>'], '']);
|
|
59
62
|
});
|
|
60
63
|
|
|
61
|
-
it('
|
|
62
|
-
assert.deepStrictEqual(inspect(parser('[% a %]')), [['<p><span class="
|
|
63
|
-
assert.deepStrictEqual(inspect(parser('[% a %]b')), [['<p><span class="
|
|
64
|
-
assert.deepStrictEqual(inspect(parser('[% a %]\nb')), [['<p><span class="
|
|
65
|
-
assert.deepStrictEqual(inspect(parser('[%% a %%]')), [['<p><span class="
|
|
66
|
-
assert.deepStrictEqual(inspect(parser('[%\n<wbr>\n%]')), [['<p><span class="
|
|
67
|
-
assert.deepStrictEqual(inspect(parser('[%\n<wbr>\n%]a')), [['<p><span class="
|
|
68
|
-
assert.deepStrictEqual(inspect(parser('[%\n<wbr>\n%]\na')), [['<p><span class="
|
|
64
|
+
it('remark', () => {
|
|
65
|
+
assert.deepStrictEqual(inspect(parser('[% a %]')), [['<p><span class="remark"><input type="checkbox"><span>[% a %]</span></span></p>'], '']);
|
|
66
|
+
assert.deepStrictEqual(inspect(parser('[% a %]b')), [['<p><span class="remark"><input type="checkbox"><span>[% a %]</span></span>b</p>'], '']);
|
|
67
|
+
assert.deepStrictEqual(inspect(parser('[% a %]\nb')), [['<p><span class="remark"><input type="checkbox"><span>[% a %]</span></span><br>b</p>'], '']);
|
|
68
|
+
assert.deepStrictEqual(inspect(parser('[%% a %%]')), [['<p><span class="remark"><input type="checkbox"><span>[%% a %%]</span></span></p>'], '']);
|
|
69
|
+
assert.deepStrictEqual(inspect(parser('[%\n<wbr>\n%]')), [['<p><span class="remark"><input type="checkbox"><span>[%<br><wbr><br>%]</span></span></p>'], '']);
|
|
70
|
+
assert.deepStrictEqual(inspect(parser('[%\n<wbr>\n%]a')), [['<p><span class="remark"><input type="checkbox"><span>[%<br><wbr><br>%]</span></span>a</p>'], '']);
|
|
71
|
+
assert.deepStrictEqual(inspect(parser('[%\n<wbr>\n%]\na')), [['<p><span class="remark"><input type="checkbox"><span>[%<br><wbr><br>%]</span></span><br>a</p>'], '']);
|
|
69
72
|
});
|
|
70
73
|
|
|
71
74
|
it('template', () => {
|