securemark 0.234.1 → 0.235.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/securemark.js +128 -136
- package/markdown.d.ts +4 -16
- package/package-lock.json +46 -43
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.ts +0 -2
- package/src/combinator/control/constraint/contract.ts +1 -1
- package/src/combinator/control/manipulation/context.ts +7 -0
- package/src/combinator/control/manipulation/match.ts +1 -1
- package/src/combinator/control/manipulation/scope.ts +1 -1
- package/src/combinator/data/parser/inits.ts +1 -1
- package/src/combinator/data/parser/sequence.ts +1 -1
- package/src/combinator/data/parser/some.ts +40 -18
- package/src/combinator/data/parser.ts +4 -1
- package/src/parser/api/normalize.ts +7 -6
- package/src/parser/block/heading.test.ts +1 -1
- package/src/parser/block/paragraph.test.ts +2 -0
- package/src/parser/inline/emphasis.test.ts +7 -4
- package/src/parser/inline/emphasis.ts +7 -7
- package/src/parser/inline/emstrong.ts +19 -18
- package/src/parser/inline/extension/index.test.ts +19 -18
- package/src/parser/inline/extension/index.ts +3 -4
- package/src/parser/inline/extension/indexer.test.ts +1 -0
- package/src/parser/inline/extension/indexer.ts +1 -0
- package/src/parser/inline/html.ts +4 -8
- package/src/parser/inline/htmlentity.test.ts +1 -0
- package/src/parser/inline/htmlentity.ts +9 -12
- package/src/parser/inline/link.ts +3 -4
- package/src/parser/inline/mark.test.ts +6 -3
- package/src/parser/inline/mark.ts +4 -4
- package/src/parser/inline/media.ts +8 -5
- package/src/parser/inline/ruby.ts +3 -4
- package/src/parser/inline/strong.test.ts +6 -4
- package/src/parser/inline/strong.ts +7 -7
- package/src/parser/inline.test.ts +15 -5
- package/src/parser/util.ts +11 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.235.0
|
|
4
|
+
|
|
5
|
+
- Change signature syntax to require leading whitespace.
|
|
6
|
+
|
|
7
|
+
## 0.234.3
|
|
8
|
+
|
|
9
|
+
- Refactoring.
|
|
10
|
+
|
|
11
|
+
## 0.234.2
|
|
12
|
+
|
|
13
|
+
- Refactoring.
|
|
14
|
+
|
|
3
15
|
## 0.234.1
|
|
4
16
|
|
|
5
17
|
- Fix emstrong parser, emphasis parser, strong parser, and mark parser.
|
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.235.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
|
|
2
2
|
require = function () {
|
|
3
3
|
function r(e, n, t) {
|
|
4
4
|
function o(i, f) {
|
|
@@ -3318,10 +3318,14 @@ require = function () {
|
|
|
3318
3318
|
}
|
|
3319
3319
|
exports.guard = guard;
|
|
3320
3320
|
function reset(base, parser) {
|
|
3321
|
+
if (isEmpty(base))
|
|
3322
|
+
return parser;
|
|
3321
3323
|
return (source, context) => parser(source, inherit((0, alias_1.ObjectCreate)(context), base));
|
|
3322
3324
|
}
|
|
3323
3325
|
exports.reset = reset;
|
|
3324
3326
|
function context(base, parser) {
|
|
3327
|
+
if (isEmpty(base))
|
|
3328
|
+
return parser;
|
|
3325
3329
|
const override = (0, memoize_1.memoize)(context => inherit((0, alias_1.ObjectCreate)(context), base), new global_1.WeakMap());
|
|
3326
3330
|
return (source, context) => parser(source, override(context));
|
|
3327
3331
|
}
|
|
@@ -3347,6 +3351,11 @@ require = function () {
|
|
|
3347
3351
|
return target[prop] = source[prop];
|
|
3348
3352
|
}
|
|
3349
3353
|
});
|
|
3354
|
+
function isEmpty(context) {
|
|
3355
|
+
for (const _ in context)
|
|
3356
|
+
return false;
|
|
3357
|
+
return true;
|
|
3358
|
+
}
|
|
3350
3359
|
},
|
|
3351
3360
|
{
|
|
3352
3361
|
'spica/alias': 5,
|
|
@@ -3906,28 +3915,56 @@ require = function () {
|
|
|
3906
3915
|
exports.some = void 0;
|
|
3907
3916
|
const global_1 = _dereq_('spica/global');
|
|
3908
3917
|
const parser_1 = _dereq_('../parser');
|
|
3918
|
+
const memoize_1 = _dereq_('spica/memoize');
|
|
3909
3919
|
const array_1 = _dereq_('spica/array');
|
|
3920
|
+
const signature = pattern => {
|
|
3921
|
+
switch (typeof pattern) {
|
|
3922
|
+
case 'undefined':
|
|
3923
|
+
return signature('');
|
|
3924
|
+
case 'string':
|
|
3925
|
+
return `s:${ pattern }`;
|
|
3926
|
+
case 'object':
|
|
3927
|
+
return `r/${ pattern.source }/${ pattern.flags }`;
|
|
3928
|
+
}
|
|
3929
|
+
};
|
|
3930
|
+
const [matcher, delimiter] = [...Array(2)].map(() => (0, memoize_1.memoize)(pattern => {
|
|
3931
|
+
switch (typeof pattern) {
|
|
3932
|
+
case 'undefined':
|
|
3933
|
+
return () => false;
|
|
3934
|
+
case 'string':
|
|
3935
|
+
return source => source.slice(0, pattern.length) === pattern;
|
|
3936
|
+
case 'object':
|
|
3937
|
+
return (0, memoize_1.reduce)(source => pattern.test(source));
|
|
3938
|
+
}
|
|
3939
|
+
}, signature));
|
|
3910
3940
|
function some(parser, until, deep, limit = -1) {
|
|
3911
3941
|
if (typeof until === 'number')
|
|
3912
3942
|
return some(parser, global_1.undefined, deep, until);
|
|
3913
|
-
const match =
|
|
3914
|
-
const delim =
|
|
3915
|
-
|
|
3943
|
+
const match = matcher(until);
|
|
3944
|
+
const delim = delimiter(deep);
|
|
3945
|
+
const sig = signature(deep);
|
|
3916
3946
|
return (source, context) => {
|
|
3917
3947
|
var _a, _b, _c;
|
|
3918
|
-
|
|
3948
|
+
var _d;
|
|
3949
|
+
if (source === '')
|
|
3919
3950
|
return;
|
|
3920
3951
|
let rest = source;
|
|
3921
3952
|
let nodes;
|
|
3922
3953
|
if (context && deep) {
|
|
3923
|
-
|
|
3954
|
+
(_a = context.delimiters) !== null && _a !== void 0 ? _a : context.delimiters = {
|
|
3955
|
+
stack: [],
|
|
3956
|
+
matchers: {}
|
|
3957
|
+
};
|
|
3958
|
+
context.delimiters.stack.push(sig);
|
|
3959
|
+
(_b = (_d = context.delimiters.matchers)[sig]) !== null && _b !== void 0 ? _b : _d[sig] = delim;
|
|
3924
3960
|
}
|
|
3961
|
+
const {stack, matchers} = (_c = context.delimiters) !== null && _c !== void 0 ? _c : {};
|
|
3925
3962
|
while (true) {
|
|
3926
3963
|
if (rest === '')
|
|
3927
3964
|
break;
|
|
3928
3965
|
if (match(rest))
|
|
3929
3966
|
break;
|
|
3930
|
-
if (
|
|
3967
|
+
if (stack === null || stack === void 0 ? void 0 : stack.some(sig => matchers[sig](rest)))
|
|
3931
3968
|
break;
|
|
3932
3969
|
const result = parser(rest, context);
|
|
3933
3970
|
if (!result)
|
|
@@ -3938,9 +3975,8 @@ require = function () {
|
|
|
3938
3975
|
break;
|
|
3939
3976
|
}
|
|
3940
3977
|
if (context && deep) {
|
|
3941
|
-
|
|
3978
|
+
stack === null || stack === void 0 ? void 0 : stack.pop();
|
|
3942
3979
|
}
|
|
3943
|
-
memory = limit < 0 && rest || memory;
|
|
3944
3980
|
return nodes && rest.length < source.length ? [
|
|
3945
3981
|
nodes,
|
|
3946
3982
|
rest
|
|
@@ -3952,7 +3988,8 @@ require = function () {
|
|
|
3952
3988
|
{
|
|
3953
3989
|
'../parser': 47,
|
|
3954
3990
|
'spica/array': 6,
|
|
3955
|
-
'spica/global': 15
|
|
3991
|
+
'spica/global': 15,
|
|
3992
|
+
'spica/memoize': 18
|
|
3956
3993
|
}
|
|
3957
3994
|
],
|
|
3958
3995
|
51: [
|
|
@@ -4373,10 +4410,9 @@ require = function () {
|
|
|
4373
4410
|
function (_dereq_, module, exports) {
|
|
4374
4411
|
'use strict';
|
|
4375
4412
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4376
|
-
exports.escape = exports.normalize = void 0;
|
|
4413
|
+
exports.escape = exports.invisibleHTMLEntityNames = exports.normalize = void 0;
|
|
4377
4414
|
const parser_1 = _dereq_('../../combinator/data/parser');
|
|
4378
4415
|
const htmlentity_1 = _dereq_('../inline/htmlentity');
|
|
4379
|
-
const util_1 = _dereq_('../util');
|
|
4380
4416
|
const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
|
|
4381
4417
|
function normalize(source) {
|
|
4382
4418
|
return sanitize(format(source));
|
|
@@ -4388,7 +4424,9 @@ require = function () {
|
|
|
4388
4424
|
function sanitize(source) {
|
|
4389
4425
|
return source.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]|[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]|(^|[^\u1820\u1821])\u180E/g, `$1${ UNICODE_REPLACEMENT_CHARACTER }`).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g, char => char.length === 1 ? UNICODE_REPLACEMENT_CHARACTER : char);
|
|
4390
4426
|
}
|
|
4391
|
-
|
|
4427
|
+
exports.invisibleHTMLEntityNames = [
|
|
4428
|
+
'Tab',
|
|
4429
|
+
'NewLine',
|
|
4392
4430
|
'NonBreakingSpace',
|
|
4393
4431
|
'nbsp',
|
|
4394
4432
|
'shy',
|
|
@@ -4420,7 +4458,8 @@ require = function () {
|
|
|
4420
4458
|
'InvisibleComma',
|
|
4421
4459
|
'ic'
|
|
4422
4460
|
];
|
|
4423
|
-
const
|
|
4461
|
+
const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
|
|
4462
|
+
const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(`&${ name };`, {}))[0]);
|
|
4424
4463
|
const unreadableEscapableCharacter = new RegExp(`[${ [...new Set(unreadableEscapableCharacters)].join('') }]`, 'g');
|
|
4425
4464
|
const unreadableSpecialCharacters = [
|
|
4426
4465
|
'\u2006',
|
|
@@ -4445,8 +4484,7 @@ require = function () {
|
|
|
4445
4484
|
},
|
|
4446
4485
|
{
|
|
4447
4486
|
'../../combinator/data/parser': 47,
|
|
4448
|
-
'../inline/htmlentity': 112
|
|
4449
|
-
'../util': 134
|
|
4487
|
+
'../inline/htmlentity': 112
|
|
4450
4488
|
}
|
|
4451
4489
|
],
|
|
4452
4490
|
61: [
|
|
@@ -6672,14 +6710,11 @@ require = function () {
|
|
|
6672
6710
|
const util_1 = _dereq_('../util');
|
|
6673
6711
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6674
6712
|
const array_1 = _dereq_('spica/array');
|
|
6675
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0,
|
|
6713
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
6676
6714
|
strong_1.strong,
|
|
6677
|
-
(0, combinator_1.some)(inline_1.inline,
|
|
6678
|
-
(0, combinator_1.
|
|
6679
|
-
|
|
6680
|
-
inline_1.inline
|
|
6681
|
-
])
|
|
6682
|
-
]))), (0, source_1.str)('*'), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
|
|
6715
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.delimiter)(/\*/)),
|
|
6716
|
+
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6717
|
+
])), '*'), (0, source_1.str)('*'), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
|
|
6683
6718
|
[(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))],
|
|
6684
6719
|
rest
|
|
6685
6720
|
] : [
|
|
@@ -6713,26 +6748,17 @@ require = function () {
|
|
|
6713
6748
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6714
6749
|
const array_1 = _dereq_('spica/array');
|
|
6715
6750
|
const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([
|
|
6716
|
-
(0, combinator_1.some)(inline_1.inline,
|
|
6717
|
-
(0, combinator_1.
|
|
6718
|
-
(0, combinator_1.some)(inline_1.inline, '*'),
|
|
6719
|
-
inline_1.inline
|
|
6720
|
-
])
|
|
6751
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.delimiter)(/\*\*/)),
|
|
6752
|
+
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6721
6753
|
])));
|
|
6722
6754
|
const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([
|
|
6723
6755
|
strong_1.strong,
|
|
6724
|
-
(0, combinator_1.some)(inline_1.inline,
|
|
6725
|
-
(0, combinator_1.
|
|
6726
|
-
(0, combinator_1.some)(inline_1.inline, '*'),
|
|
6727
|
-
inline_1.inline
|
|
6728
|
-
])
|
|
6756
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.delimiter)(/\*/)),
|
|
6757
|
+
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6729
6758
|
])));
|
|
6730
6759
|
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
6731
|
-
(0, combinator_1.some)(inline_1.inline,
|
|
6732
|
-
(0, combinator_1.
|
|
6733
|
-
(0, combinator_1.some)(inline_1.inline, '*'),
|
|
6734
|
-
inline_1.inline
|
|
6735
|
-
])
|
|
6760
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.delimiter)(/\*/)),
|
|
6761
|
+
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6736
6762
|
]))), (0, source_1.str)(/^\*{1,3}/), false, ([as, bs, cs], rest, context) => {
|
|
6737
6763
|
var _a, _b;
|
|
6738
6764
|
if (!(0, util_1.isEndTightNodes)(bs))
|
|
@@ -6741,25 +6767,13 @@ require = function () {
|
|
|
6741
6767
|
cs[0] + rest
|
|
6742
6768
|
];
|
|
6743
6769
|
switch (cs[0]) {
|
|
6744
|
-
case '
|
|
6745
|
-
return
|
|
6746
|
-
[(0, typed_dom_1.html)('
|
|
6747
|
-
rest.slice(2)
|
|
6748
|
-
] : [
|
|
6749
|
-
(0, array_1.unshift)([
|
|
6750
|
-
'**',
|
|
6751
|
-
(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))
|
|
6752
|
-
], ds),
|
|
6753
|
-
rest
|
|
6754
|
-
])(rest, context)) !== null && _a !== void 0 ? _a : [
|
|
6755
|
-
[
|
|
6756
|
-
'**',
|
|
6757
|
-
(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))
|
|
6758
|
-
],
|
|
6770
|
+
case '***':
|
|
6771
|
+
return [
|
|
6772
|
+
[(0, typed_dom_1.html)('em', [(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))])],
|
|
6759
6773
|
rest
|
|
6760
6774
|
];
|
|
6761
6775
|
case '**':
|
|
6762
|
-
return (
|
|
6776
|
+
return (_a = (0, combinator_1.bind)(subemphasis, (ds, rest) => rest.slice(0, 1) === '*' && (0, util_1.isEndTightNodes)(ds) ? [
|
|
6763
6777
|
[(0, typed_dom_1.html)('em', (0, array_1.unshift)([(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))], (0, typed_dom_1.defrag)(ds)))],
|
|
6764
6778
|
rest.slice(1)
|
|
6765
6779
|
] : [
|
|
@@ -6768,16 +6782,28 @@ require = function () {
|
|
|
6768
6782
|
(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))
|
|
6769
6783
|
], ds),
|
|
6770
6784
|
rest
|
|
6771
|
-
])(rest, context)) !== null &&
|
|
6785
|
+
])(rest, context)) !== null && _a !== void 0 ? _a : [
|
|
6772
6786
|
[
|
|
6773
6787
|
'*',
|
|
6774
6788
|
(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))
|
|
6775
6789
|
],
|
|
6776
6790
|
rest
|
|
6777
6791
|
];
|
|
6778
|
-
case '
|
|
6779
|
-
return [
|
|
6780
|
-
[(0, typed_dom_1.html)('
|
|
6792
|
+
case '*':
|
|
6793
|
+
return (_b = (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' && (0, util_1.isEndTightNodes)(ds) ? [
|
|
6794
|
+
[(0, typed_dom_1.html)('strong', (0, array_1.unshift)([(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))], (0, typed_dom_1.defrag)(ds)))],
|
|
6795
|
+
rest.slice(2)
|
|
6796
|
+
] : [
|
|
6797
|
+
(0, array_1.unshift)([
|
|
6798
|
+
'**',
|
|
6799
|
+
(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))
|
|
6800
|
+
], ds),
|
|
6801
|
+
rest
|
|
6802
|
+
])(rest, context)) !== null && _b !== void 0 ? _b : [
|
|
6803
|
+
[
|
|
6804
|
+
'**',
|
|
6805
|
+
(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))
|
|
6806
|
+
],
|
|
6781
6807
|
rest
|
|
6782
6808
|
];
|
|
6783
6809
|
}
|
|
@@ -6881,18 +6907,18 @@ require = function () {
|
|
|
6881
6907
|
autolink: false
|
|
6882
6908
|
}
|
|
6883
6909
|
}
|
|
6884
|
-
}, (0, combinator_1.
|
|
6910
|
+
}, (0, combinator_1.some)((0, combinator_1.union)([
|
|
6885
6911
|
signature,
|
|
6886
6912
|
inline_1.inline
|
|
6887
|
-
]), ']', /^\\?\n/)
|
|
6913
|
+
]), ']', /^\\?\n/)))), ']'), ns => [(0, typed_dom_1.html)('a', (0, util_1.trimNodeEnd)((0, typed_dom_1.defrag)(ns)))])), ([el]) => [(0, typed_dom_1.define)(el, {
|
|
6888
6914
|
id: el.id ? null : global_1.undefined,
|
|
6889
6915
|
class: 'index',
|
|
6890
6916
|
href: el.id ? `#${ el.id }` : global_1.undefined
|
|
6891
6917
|
}, el.childNodes)]))));
|
|
6892
|
-
const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)(
|
|
6918
|
+
const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)(/^\s+\|#/, (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
6893
6919
|
bracket,
|
|
6894
6920
|
source_1.txt
|
|
6895
|
-
]), ']'
|
|
6921
|
+
]), ']'))), ns => [(0, typed_dom_1.html)('span', {
|
|
6896
6922
|
class: 'indexer',
|
|
6897
6923
|
'data-index': (0, indexee_1.identity)((0, array_1.join)(ns)).slice(6)
|
|
6898
6924
|
})])));
|
|
@@ -7125,8 +7151,8 @@ require = function () {
|
|
|
7125
7151
|
(0, alias_1.ObjectSetPrototypeOf)(attrspec, null);
|
|
7126
7152
|
(0, alias_1.ObjectValues)(attrspec).forEach(o => (0, alias_1.ObjectSetPrototypeOf)(o, null));
|
|
7127
7153
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([
|
|
7128
|
-
(0, combinator_1.match)(/^(?=<(wbr)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)(
|
|
7129
|
-
[(0, typed_dom_1.html)(tag, attributes('html', [], attrspec[tag],
|
|
7154
|
+
(0, combinator_1.match)(/^(?=<(wbr)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)(`<${ tag }`, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), '>', true, ([, bs = []], rest) => [
|
|
7155
|
+
[(0, typed_dom_1.html)(tag, attributes('html', [], attrspec[tag], bs))],
|
|
7130
7156
|
rest
|
|
7131
7157
|
]), ([, tag]) => tag)),
|
|
7132
7158
|
(0, combinator_1.match)(/^(?=<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)('>'), true), (0, util_1.startLoose)((0, combinator_1.context)((() => {
|
|
@@ -7249,17 +7275,16 @@ require = function () {
|
|
|
7249
7275
|
exports.htmlentity = exports.unsafehtmlentity = void 0;
|
|
7250
7276
|
const combinator_1 = _dereq_('../../combinator');
|
|
7251
7277
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
[(parser.innerHTML = entity, parser.value)],
|
|
7278
|
+
exports.unsafehtmlentity = (0, combinator_1.creator)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&(?!NewLine;)[0-9A-Za-z]+;/, (parser => entity => (parser.innerHTML = entity, entity = parser.textContent, [
|
|
7279
|
+
[`${ entity[0] !== '&' || entity.length === 1 ? '' : '\0' }${ entity }`],
|
|
7255
7280
|
''
|
|
7256
|
-
]), (
|
|
7257
|
-
exports.htmlentity = (0, combinator_1.
|
|
7281
|
+
]))((0, typed_dom_1.html)('b')))));
|
|
7282
|
+
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([str]) => [str[0] === '\0' ? (0, typed_dom_1.html)('span', {
|
|
7258
7283
|
class: 'invalid',
|
|
7259
7284
|
'data-invalid-syntax': 'htmlentity',
|
|
7260
7285
|
'data-invalid-type': 'syntax',
|
|
7261
7286
|
'data-invalid-description': 'Invalid HTML entity.'
|
|
7262
|
-
}, str.slice(1)) : str])
|
|
7287
|
+
}, str.slice(1)) : str]);
|
|
7263
7288
|
},
|
|
7264
7289
|
{
|
|
7265
7290
|
'../../combinator': 27,
|
|
@@ -7312,10 +7337,10 @@ require = function () {
|
|
|
7312
7337
|
const url_1 = _dereq_('spica/url');
|
|
7313
7338
|
const optspec = { rel: ['nofollow'] };
|
|
7314
7339
|
(0, alias_1.ObjectSetPrototypeOf)(optspec, null);
|
|
7315
|
-
exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.
|
|
7340
|
+
exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)([
|
|
7316
7341
|
'[',
|
|
7317
7342
|
'{'
|
|
7318
|
-
], '}', '\n', (0, combinator_1.guard)(context => {
|
|
7343
|
+
], '}', '\n', (0, combinator_1.bind)((0, combinator_1.guard)(context => {
|
|
7319
7344
|
var _a, _b, _c;
|
|
7320
7345
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.link) !== null && _c !== void 0 ? _c : true;
|
|
7321
7346
|
}, (0, combinator_1.reverse)((0, combinator_1.tails)([
|
|
@@ -7339,7 +7364,7 @@ require = function () {
|
|
|
7339
7364
|
exports.uri,
|
|
7340
7365
|
(0, combinator_1.some)(exports.option)
|
|
7341
7366
|
]), /^[^\S\n]?}/))
|
|
7342
|
-
])))
|
|
7367
|
+
]))), ([params, content = []], rest, context) => {
|
|
7343
7368
|
var _a, _b, _c, _d, _e, _f;
|
|
7344
7369
|
if ((_a = (0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))) === null || _a === void 0 ? void 0 : _a.some(node => typeof node === 'object'))
|
|
7345
7370
|
return;
|
|
@@ -7354,7 +7379,7 @@ require = function () {
|
|
|
7354
7379
|
[(0, typed_dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))],
|
|
7355
7380
|
rest
|
|
7356
7381
|
];
|
|
7357
|
-
})));
|
|
7382
|
+
}))));
|
|
7358
7383
|
exports.uri = (0, combinator_1.union)([
|
|
7359
7384
|
(0, combinator_1.open)(/^[^\S\n]/, (0, source_1.str)(/^\S+/)),
|
|
7360
7385
|
(0, source_1.str)(/^[^\s{}]+/)
|
|
@@ -7450,11 +7475,8 @@ require = function () {
|
|
|
7450
7475
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7451
7476
|
const array_1 = _dereq_('spica/array');
|
|
7452
7477
|
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
7453
|
-
(0, combinator_1.some)(inline_1.inline,
|
|
7454
|
-
(0, combinator_1.
|
|
7455
|
-
(0, combinator_1.some)(inline_1.inline, '='),
|
|
7456
|
-
inline_1.inline
|
|
7457
|
-
])
|
|
7478
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.delimiter)(/==/)),
|
|
7479
|
+
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)
|
|
7458
7480
|
]))), (0, source_1.str)('=='), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
|
|
7459
7481
|
[(0, typed_dom_1.html)('mark', (0, typed_dom_1.defrag)(bs))],
|
|
7460
7482
|
rest
|
|
@@ -7539,10 +7561,10 @@ require = function () {
|
|
|
7539
7561
|
rel: global_1.undefined
|
|
7540
7562
|
};
|
|
7541
7563
|
(0, alias_1.ObjectSetPrototypeOf)(optspec, null);
|
|
7542
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.
|
|
7543
|
-
'[',
|
|
7544
|
-
'{'
|
|
7545
|
-
], '}', '\n', (0, combinator_1.guard)(context => {
|
|
7564
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)([
|
|
7565
|
+
'![',
|
|
7566
|
+
'!{'
|
|
7567
|
+
], '}', '\n', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => {
|
|
7546
7568
|
var _a, _b, _c;
|
|
7547
7569
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.media) !== null && _c !== void 0 ? _c : true;
|
|
7548
7570
|
}, (0, combinator_1.tails)([
|
|
@@ -7555,7 +7577,7 @@ require = function () {
|
|
|
7555
7577
|
link_1.uri,
|
|
7556
7578
|
(0, combinator_1.some)(option)
|
|
7557
7579
|
]), /^[^\S\n]?}/))
|
|
7558
|
-
])))
|
|
7580
|
+
]))), ([as, bs]) => bs ? [
|
|
7559
7581
|
[(0, array_1.join)(as).trim() || (0, array_1.join)(as)],
|
|
7560
7582
|
bs
|
|
7561
7583
|
] : [
|
|
@@ -7584,7 +7606,7 @@ require = function () {
|
|
|
7584
7606
|
rest
|
|
7585
7607
|
];
|
|
7586
7608
|
return (0, combinator_1.fmap)(link_1.link, ([link]) => [(0, typed_dom_1.define)(link, { target: '_blank' }, [el])])(`{ ${ INSECURE_URI }${ (0, array_1.join)(params) } }${ rest }`, context);
|
|
7587
|
-
})));
|
|
7609
|
+
}))));
|
|
7588
7610
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([
|
|
7589
7611
|
(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([
|
|
7590
7612
|
htmlentity_1.unsafehtmlentity,
|
|
@@ -7742,10 +7764,10 @@ require = function () {
|
|
|
7742
7764
|
const util_1 = _dereq_('../util');
|
|
7743
7765
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7744
7766
|
const array_1 = _dereq_('spica/array');
|
|
7745
|
-
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.
|
|
7767
|
+
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[', ')', '\n', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.sequence)([
|
|
7746
7768
|
(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\[\]\n])+(?=]\()/, text), ']'),
|
|
7747
7769
|
(0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\(\)\n])+(?=\))/, text), ')')
|
|
7748
|
-
])
|
|
7770
|
+
]), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies], rest) => {
|
|
7749
7771
|
const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
|
|
7750
7772
|
tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
|
|
7751
7773
|
switch (true) {
|
|
@@ -7777,7 +7799,7 @@ require = function () {
|
|
|
7777
7799
|
rest
|
|
7778
7800
|
];
|
|
7779
7801
|
}
|
|
7780
|
-
})));
|
|
7802
|
+
}))));
|
|
7781
7803
|
const text = (0, combinator_1.creator)((source, context) => {
|
|
7782
7804
|
var _a;
|
|
7783
7805
|
const acc = [''];
|
|
@@ -7871,13 +7893,10 @@ require = function () {
|
|
|
7871
7893
|
const util_1 = _dereq_('../util');
|
|
7872
7894
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7873
7895
|
const array_1 = _dereq_('spica/array');
|
|
7874
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0,
|
|
7875
|
-
(0, combinator_1.some)(inline_1.inline,
|
|
7876
|
-
(0, combinator_1.
|
|
7877
|
-
|
|
7878
|
-
inline_1.inline
|
|
7879
|
-
])
|
|
7880
|
-
]))), (0, source_1.str)('**'), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
|
|
7896
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
7897
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.delimiter)(/\*\*/)),
|
|
7898
|
+
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
7899
|
+
])), '*'), (0, source_1.str)('**'), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
|
|
7881
7900
|
[(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))],
|
|
7882
7901
|
rest
|
|
7883
7902
|
] : [
|
|
@@ -8668,49 +8687,20 @@ require = function () {
|
|
|
8668
8687
|
function (_dereq_, module, exports) {
|
|
8669
8688
|
'use strict';
|
|
8670
8689
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8671
|
-
exports.stringify = exports.trimNodeEndBR = exports.trimNodeEnd = exports.trimNode = exports.isEndTightNodes = exports.isStartTightNodes = exports.startTight = exports.isStartLoose = exports.startLoose = exports.visualize = void 0;
|
|
8690
|
+
exports.stringify = exports.trimNodeEndBR = exports.trimNodeEnd = exports.trimNode = exports.isEndTightNodes = exports.isStartTightNodes = exports.startTight = exports.isStartLoose = exports.startLoose = exports.visualize = exports.delimiter = void 0;
|
|
8672
8691
|
const global_1 = _dereq_('spica/global');
|
|
8673
8692
|
const parser_1 = _dereq_('../combinator/data/parser');
|
|
8674
8693
|
const combinator_1 = _dereq_('../combinator');
|
|
8675
8694
|
const htmlentity_1 = _dereq_('./inline/htmlentity');
|
|
8676
8695
|
const source_1 = _dereq_('./source');
|
|
8696
|
+
const normalize_1 = _dereq_('./api/normalize');
|
|
8677
8697
|
const array_1 = _dereq_('spica/array');
|
|
8678
|
-
|
|
8679
|
-
'
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
'nbsp',
|
|
8683
|
-
'shy',
|
|
8684
|
-
'ensp',
|
|
8685
|
-
'emsp',
|
|
8686
|
-
'emsp13',
|
|
8687
|
-
'emsp14',
|
|
8688
|
-
'numsp',
|
|
8689
|
-
'puncsp',
|
|
8690
|
-
'ThinSpace',
|
|
8691
|
-
'thinsp',
|
|
8692
|
-
'VeryThinSpace',
|
|
8693
|
-
'hairsp',
|
|
8694
|
-
'ZeroWidthSpace',
|
|
8695
|
-
'NegativeVeryThinSpace',
|
|
8696
|
-
'NegativeThinSpace',
|
|
8697
|
-
'NegativeMediumSpace',
|
|
8698
|
-
'NegativeThickSpace',
|
|
8699
|
-
'zwj',
|
|
8700
|
-
'zwnj',
|
|
8701
|
-
'lrm',
|
|
8702
|
-
'rlm',
|
|
8703
|
-
'MediumSpace',
|
|
8704
|
-
'NoBreak',
|
|
8705
|
-
'ApplyFunction',
|
|
8706
|
-
'af',
|
|
8707
|
-
'InvisibleTimes',
|
|
8708
|
-
'it',
|
|
8709
|
-
'InvisibleComma',
|
|
8710
|
-
'ic'
|
|
8711
|
-
];
|
|
8712
|
-
const blankline = new RegExp(String.raw`^(?!$)(?:\\$|\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>)+$`, 'gm');
|
|
8698
|
+
function delimiter(opener) {
|
|
8699
|
+
return new RegExp(String.raw`^(?:\s+|\\\s|&(?:${ normalize_1.invisibleHTMLEntityNames.join('|') });|<wbr>)?${ opener.source }`);
|
|
8700
|
+
}
|
|
8701
|
+
exports.delimiter = delimiter;
|
|
8713
8702
|
function visualize(parser) {
|
|
8703
|
+
const blankline = new RegExp(String.raw`^(?:\\$|\\?[^\S\n]|&(?:${ normalize_1.invisibleHTMLEntityNames.join('|') });|<wbr>)+$`, 'gm');
|
|
8714
8704
|
return (0, combinator_1.union)([
|
|
8715
8705
|
(0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
|
|
8716
8706
|
(0, combinator_1.some)((0, combinator_1.union)([
|
|
@@ -8746,21 +8736,22 @@ require = function () {
|
|
|
8746
8736
|
}
|
|
8747
8737
|
exports.startLoose = startLoose;
|
|
8748
8738
|
function isStartLoose(source, context, except) {
|
|
8749
|
-
var _a;
|
|
8750
8739
|
source && (source = source.replace(/^[^\S\n]+/, ''));
|
|
8751
8740
|
if (source === '')
|
|
8752
8741
|
return true;
|
|
8753
|
-
return
|
|
8742
|
+
return isStartTight(source, context, except);
|
|
8754
8743
|
}
|
|
8755
8744
|
exports.isStartLoose = isStartLoose;
|
|
8756
|
-
function startTight(parser) {
|
|
8757
|
-
return (source, context) => isStartTight(source, context) ? parser(source, context) : global_1.undefined;
|
|
8745
|
+
function startTight(parser, except) {
|
|
8746
|
+
return (source, context) => isStartTight(source, context, except) ? parser(source, context) : global_1.undefined;
|
|
8758
8747
|
}
|
|
8759
8748
|
exports.startTight = startTight;
|
|
8760
|
-
function isStartTight(source, context) {
|
|
8749
|
+
function isStartTight(source, context, except) {
|
|
8761
8750
|
var _a, _b, _c;
|
|
8762
8751
|
if (source === '')
|
|
8763
8752
|
return true;
|
|
8753
|
+
if (except && source.slice(0, except.length) === except)
|
|
8754
|
+
return false;
|
|
8764
8755
|
switch (source[0]) {
|
|
8765
8756
|
case ' ':
|
|
8766
8757
|
case '\u3000':
|
|
@@ -8880,6 +8871,7 @@ require = function () {
|
|
|
8880
8871
|
{
|
|
8881
8872
|
'../combinator': 27,
|
|
8882
8873
|
'../combinator/data/parser': 47,
|
|
8874
|
+
'./api/normalize': 60,
|
|
8883
8875
|
'./inline/htmlentity': 112,
|
|
8884
8876
|
'./source': 128,
|
|
8885
8877
|
'spica/array': 6,
|
package/markdown.d.ts
CHANGED
|
@@ -970,10 +970,7 @@ export namespace MarkdownParser {
|
|
|
970
970
|
Inline<'mark'>,
|
|
971
971
|
Parser<HTMLElement | string, Context, [
|
|
972
972
|
InlineParser,
|
|
973
|
-
|
|
974
|
-
InlineParser,
|
|
975
|
-
InlineParser,
|
|
976
|
-
]>,
|
|
973
|
+
InlineParser,
|
|
977
974
|
]> {
|
|
978
975
|
}
|
|
979
976
|
export interface EmStrongParser extends
|
|
@@ -981,10 +978,7 @@ export namespace MarkdownParser {
|
|
|
981
978
|
Inline<'emstrong'>,
|
|
982
979
|
Parser<HTMLElement | string, Context, [
|
|
983
980
|
InlineParser,
|
|
984
|
-
|
|
985
|
-
InlineParser,
|
|
986
|
-
InlineParser,
|
|
987
|
-
]>,
|
|
981
|
+
InlineParser,
|
|
988
982
|
]> {
|
|
989
983
|
}
|
|
990
984
|
export interface StrongParser extends
|
|
@@ -992,10 +986,7 @@ export namespace MarkdownParser {
|
|
|
992
986
|
Inline<'strong'>,
|
|
993
987
|
Parser<HTMLElement | string, Context, [
|
|
994
988
|
InlineParser,
|
|
995
|
-
|
|
996
|
-
InlineParser,
|
|
997
|
-
InlineParser,
|
|
998
|
-
]>,
|
|
989
|
+
InlineParser,
|
|
999
990
|
]> {
|
|
1000
991
|
}
|
|
1001
992
|
export interface EmphasisParser extends
|
|
@@ -1004,10 +995,7 @@ export namespace MarkdownParser {
|
|
|
1004
995
|
Parser<HTMLElement | string, Context, [
|
|
1005
996
|
StrongParser,
|
|
1006
997
|
InlineParser,
|
|
1007
|
-
|
|
1008
|
-
InlineParser,
|
|
1009
|
-
InlineParser,
|
|
1010
|
-
]>,
|
|
998
|
+
InlineParser,
|
|
1011
999
|
]> {
|
|
1012
1000
|
}
|
|
1013
1001
|
export interface CodeParser extends
|