securemark 0.231.2 → 0.232.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 +5 -0
- package/dist/securemark.js +57 -49
- package/index.d.ts +2 -2
- package/markdown.d.ts +44 -42
- package/package-lock.json +16 -16
- package/package.json +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/paragraph.test.ts +4 -12
- package/src/parser/block/paragraph.ts +3 -17
- package/src/parser/block/{paragraph/mention → reply}/cite.test.ts +3 -3
- package/src/parser/block/{paragraph/mention → reply}/cite.ts +5 -5
- package/src/parser/block/{paragraph/mention → reply}/quote.test.ts +3 -3
- package/src/parser/block/{paragraph/mention → reply}/quote.ts +9 -9
- package/src/parser/block/reply.test.ts +22 -0
- package/src/parser/block/reply.ts +27 -0
- package/src/parser/block.ts +3 -0
- package/src/parser/util.ts +1 -1
- package/src/util/info.test.ts +1 -1
- package/src/util/info.ts +2 -2
- package/src/util/quote.ts +1 -1
- package/src/util/scope.ts +3 -1
- package/src/parser/block/paragraph/mention.ts +0 -9
package/CHANGELOG.md
CHANGED
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.232.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) {
|
|
@@ -4544,6 +4544,7 @@ require = function () {
|
|
|
4544
4544
|
const codeblock_1 = _dereq_('./block/codeblock');
|
|
4545
4545
|
const mathblock_1 = _dereq_('./block/mathblock');
|
|
4546
4546
|
const extension_1 = _dereq_('./block/extension');
|
|
4547
|
+
const reply_1 = _dereq_('./block/reply');
|
|
4547
4548
|
const paragraph_1 = _dereq_('./block/paragraph');
|
|
4548
4549
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
4549
4550
|
const random_1 = _dereq_('spica/random');
|
|
@@ -4560,6 +4561,7 @@ require = function () {
|
|
|
4560
4561
|
mathblock_1.mathblock,
|
|
4561
4562
|
extension_1.extension,
|
|
4562
4563
|
blockquote_1.blockquote,
|
|
4564
|
+
reply_1.reply,
|
|
4563
4565
|
paragraph_1.paragraph
|
|
4564
4566
|
]))));
|
|
4565
4567
|
function error(parser) {
|
|
@@ -4593,6 +4595,7 @@ require = function () {
|
|
|
4593
4595
|
'./block/mathblock': 79,
|
|
4594
4596
|
'./block/olist': 80,
|
|
4595
4597
|
'./block/paragraph': 81,
|
|
4598
|
+
'./block/reply': 82,
|
|
4596
4599
|
'./block/table': 85,
|
|
4597
4600
|
'./block/ulist': 86,
|
|
4598
4601
|
'./source': 128,
|
|
@@ -5307,7 +5310,7 @@ require = function () {
|
|
|
5307
5310
|
colspan,
|
|
5308
5311
|
...valid ? { 'data-highlight-level': +highlight > 1 ? highlight : global_1.undefined } : {
|
|
5309
5312
|
'data-invalid-syntax': 'table',
|
|
5310
|
-
'data-invalid-type': '
|
|
5313
|
+
'data-invalid-type': 'syntax',
|
|
5311
5314
|
'data-invalid-description': 'Too much highlight level.'
|
|
5312
5315
|
}
|
|
5313
5316
|
};
|
|
@@ -5776,31 +5779,17 @@ require = function () {
|
|
|
5776
5779
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5777
5780
|
exports.paragraph = void 0;
|
|
5778
5781
|
const combinator_1 = _dereq_('../../combinator');
|
|
5779
|
-
const mention_1 = _dereq_('./paragraph/mention');
|
|
5780
|
-
const quote_1 = _dereq_('./paragraph/mention/quote');
|
|
5781
5782
|
const inline_1 = _dereq_('../inline');
|
|
5782
|
-
const source_1 = _dereq_('../source');
|
|
5783
5783
|
const locale_1 = _dereq_('../locale');
|
|
5784
5784
|
const util_1 = _dereq_('../util');
|
|
5785
5785
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5786
|
-
|
|
5787
|
-
exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.subsequence)([
|
|
5788
|
-
(0, combinator_1.some)(mention_1.mention),
|
|
5789
|
-
(0, combinator_1.some)((0, combinator_1.union)([
|
|
5790
|
-
quote_1.quote,
|
|
5791
|
-
(0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, typed_dom_1.html)('br')]))
|
|
5792
|
-
]))
|
|
5793
|
-
]), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))])));
|
|
5786
|
+
exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)(ns))])));
|
|
5794
5787
|
},
|
|
5795
5788
|
{
|
|
5796
5789
|
'../../combinator': 27,
|
|
5797
5790
|
'../inline': 88,
|
|
5798
5791
|
'../locale': 123,
|
|
5799
|
-
'../source': 128,
|
|
5800
5792
|
'../util': 134,
|
|
5801
|
-
'./paragraph/mention': 82,
|
|
5802
|
-
'./paragraph/mention/quote': 84,
|
|
5803
|
-
'spica/array': 6,
|
|
5804
5793
|
'typed-dom': 26
|
|
5805
5794
|
}
|
|
5806
5795
|
],
|
|
@@ -5808,19 +5797,37 @@ require = function () {
|
|
|
5808
5797
|
function (_dereq_, module, exports) {
|
|
5809
5798
|
'use strict';
|
|
5810
5799
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5811
|
-
exports.
|
|
5812
|
-
const combinator_1 = _dereq_('
|
|
5813
|
-
const cite_1 = _dereq_('./
|
|
5814
|
-
const quote_1 = _dereq_('./
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5800
|
+
exports.reply = void 0;
|
|
5801
|
+
const combinator_1 = _dereq_('../../combinator');
|
|
5802
|
+
const cite_1 = _dereq_('./reply/cite');
|
|
5803
|
+
const quote_1 = _dereq_('./reply/quote');
|
|
5804
|
+
const inline_1 = _dereq_('../inline');
|
|
5805
|
+
const source_1 = _dereq_('../source');
|
|
5806
|
+
const locale_1 = _dereq_('../locale');
|
|
5807
|
+
const util_1 = _dereq_('../util');
|
|
5808
|
+
const typed_dom_1 = _dereq_('typed-dom');
|
|
5809
|
+
const array_1 = _dereq_('spica/array');
|
|
5810
|
+
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.inits)([
|
|
5811
|
+
(0, combinator_1.some)((0, combinator_1.inits)([
|
|
5812
|
+
cite_1.cite,
|
|
5813
|
+
quote_1.quote
|
|
5814
|
+
])),
|
|
5815
|
+
(0, combinator_1.subsequence)([
|
|
5816
|
+
(0, combinator_1.some)(quote_1.quote),
|
|
5817
|
+
(0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, typed_dom_1.html)('br')]))
|
|
5818
|
+
])
|
|
5819
|
+
])), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
|
|
5819
5820
|
},
|
|
5820
5821
|
{
|
|
5821
|
-
'
|
|
5822
|
-
'
|
|
5823
|
-
'
|
|
5822
|
+
'../../combinator': 27,
|
|
5823
|
+
'../inline': 88,
|
|
5824
|
+
'../locale': 123,
|
|
5825
|
+
'../source': 128,
|
|
5826
|
+
'../util': 134,
|
|
5827
|
+
'./reply/cite': 83,
|
|
5828
|
+
'./reply/quote': 84,
|
|
5829
|
+
'spica/array': 6,
|
|
5830
|
+
'typed-dom': 26
|
|
5824
5831
|
}
|
|
5825
5832
|
],
|
|
5826
5833
|
83: [
|
|
@@ -5828,9 +5835,9 @@ require = function () {
|
|
|
5828
5835
|
'use strict';
|
|
5829
5836
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5830
5837
|
exports.cite = void 0;
|
|
5831
|
-
const combinator_1 = _dereq_('
|
|
5832
|
-
const anchor_1 = _dereq_('
|
|
5833
|
-
const source_1 = _dereq_('
|
|
5838
|
+
const combinator_1 = _dereq_('../../../combinator');
|
|
5839
|
+
const anchor_1 = _dereq_('../../inline/autolink/anchor');
|
|
5840
|
+
const source_1 = _dereq_('../../source');
|
|
5834
5841
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5835
5842
|
exports.cite = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.validate)('>>', (0, combinator_1.reverse)((0, combinator_1.tails)([
|
|
5836
5843
|
(0, source_1.str)(/^>*(?=>>)/),
|
|
@@ -5844,9 +5851,9 @@ require = function () {
|
|
|
5844
5851
|
])));
|
|
5845
5852
|
},
|
|
5846
5853
|
{
|
|
5847
|
-
'
|
|
5848
|
-
'
|
|
5849
|
-
'
|
|
5854
|
+
'../../../combinator': 27,
|
|
5855
|
+
'../../inline/autolink/anchor': 92,
|
|
5856
|
+
'../../source': 128,
|
|
5850
5857
|
'typed-dom': 26
|
|
5851
5858
|
}
|
|
5852
5859
|
],
|
|
@@ -5855,11 +5862,11 @@ require = function () {
|
|
|
5855
5862
|
'use strict';
|
|
5856
5863
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5857
5864
|
exports.quote = exports.syntax = void 0;
|
|
5858
|
-
const parser_1 = _dereq_('
|
|
5859
|
-
const combinator_1 = _dereq_('
|
|
5860
|
-
const math_1 = _dereq_('
|
|
5861
|
-
const source_1 = _dereq_('
|
|
5862
|
-
const autolink_1 = _dereq_('
|
|
5865
|
+
const parser_1 = _dereq_('../../../combinator/data/parser');
|
|
5866
|
+
const combinator_1 = _dereq_('../../../combinator');
|
|
5867
|
+
const math_1 = _dereq_('../../inline/math');
|
|
5868
|
+
const source_1 = _dereq_('../../source');
|
|
5869
|
+
const autolink_1 = _dereq_('../../autolink');
|
|
5863
5870
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5864
5871
|
exports.syntax = /^>+(?=[^\S\n])|^>(?=[^\s>])|^>+(?=[^\s>])(?![0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:]))/;
|
|
5865
5872
|
exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)('>', (0, combinator_1.union)([
|
|
@@ -5912,11 +5919,11 @@ require = function () {
|
|
|
5912
5919
|
]);
|
|
5913
5920
|
},
|
|
5914
5921
|
{
|
|
5915
|
-
'
|
|
5916
|
-
'
|
|
5917
|
-
'
|
|
5918
|
-
'
|
|
5919
|
-
'
|
|
5922
|
+
'../../../combinator': 27,
|
|
5923
|
+
'../../../combinator/data/parser': 47,
|
|
5924
|
+
'../../autolink': 62,
|
|
5925
|
+
'../../inline/math': 116,
|
|
5926
|
+
'../../source': 128,
|
|
5920
5927
|
'typed-dom': 26
|
|
5921
5928
|
}
|
|
5922
5929
|
],
|
|
@@ -9350,7 +9357,7 @@ require = function () {
|
|
|
9350
9357
|
exports.info = void 0;
|
|
9351
9358
|
const scope_1 = _dereq_('./scope');
|
|
9352
9359
|
function info(source) {
|
|
9353
|
-
const match = (0, scope_1.scope)(source, '
|
|
9360
|
+
const match = (0, scope_1.scope)(source, '.invalid');
|
|
9354
9361
|
return {
|
|
9355
9362
|
url: find('a:not(.email):not(.account):not(.channel):not(.hashtag):not(.hashnum):not(.anchor)').filter(el => [
|
|
9356
9363
|
'http:',
|
|
@@ -9362,7 +9369,7 @@ require = function () {
|
|
|
9362
9369
|
channel: find('a.channel'),
|
|
9363
9370
|
hashtag: find('a.hashtag'),
|
|
9364
9371
|
hashnum: find('a.hashnum'),
|
|
9365
|
-
|
|
9372
|
+
reply: find('.cite > a.anchor'),
|
|
9366
9373
|
anchor: find(':not(.cite) > a.anchor'),
|
|
9367
9374
|
media: find('.media[data-src]')
|
|
9368
9375
|
};
|
|
@@ -9387,7 +9394,7 @@ require = function () {
|
|
|
9387
9394
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9388
9395
|
exports.quote = void 0;
|
|
9389
9396
|
const parser_1 = _dereq_('../combinator/data/parser');
|
|
9390
|
-
const cite_1 = _dereq_('../parser/block/
|
|
9397
|
+
const cite_1 = _dereq_('../parser/block/reply/cite');
|
|
9391
9398
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
9392
9399
|
function quote(anchor, range) {
|
|
9393
9400
|
var _a, _b;
|
|
@@ -9466,7 +9473,7 @@ require = function () {
|
|
|
9466
9473
|
},
|
|
9467
9474
|
{
|
|
9468
9475
|
'../combinator/data/parser': 47,
|
|
9469
|
-
'../parser/block/
|
|
9476
|
+
'../parser/block/reply/cite': 83,
|
|
9470
9477
|
'typed-dom': 26
|
|
9471
9478
|
}
|
|
9472
9479
|
],
|
|
@@ -9476,7 +9483,8 @@ require = function () {
|
|
|
9476
9483
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9477
9484
|
exports.scope = void 0;
|
|
9478
9485
|
const global_1 = _dereq_('spica/global');
|
|
9479
|
-
function scope(base, bound = `${ 'id' in base && base.id ? `#${ base.id }, ` : '' }section, article, aside, blockquote`) {
|
|
9486
|
+
function scope(base, filter = '', bound = `${ 'id' in base && base.id ? `#${ base.id }, ` : '' }section, article, aside, blockquote, pre, .quote, .math, .media`) {
|
|
9487
|
+
bound += filter && `, ${ filter }`;
|
|
9480
9488
|
const memory = new global_1.WeakMap();
|
|
9481
9489
|
const context = 'id' in base && base.closest(bound) || null;
|
|
9482
9490
|
return el => {
|
package/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function normalize(source: string): string;
|
|
|
22
22
|
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
|
-
export function scope(base: DocumentFragment | HTMLElement | ShadowRoot, bound?: string): (el: Element) => boolean;
|
|
25
|
+
export function scope(base: DocumentFragment | HTMLElement | ShadowRoot, filter?: string, bound?: string): (el: Element) => boolean;
|
|
26
26
|
export function sync(editor: HTMLElement, viewer: HTMLElement, bottom?: Element | null): () => void;
|
|
27
27
|
|
|
28
28
|
export type ParserOptions = Omit<Partial<ParserSettings>, 'chunk'>;
|
|
@@ -76,7 +76,7 @@ export interface Info {
|
|
|
76
76
|
readonly channel: HTMLAnchorElement[];
|
|
77
77
|
readonly hashtag: HTMLAnchorElement[];
|
|
78
78
|
readonly hashnum: HTMLAnchorElement[];
|
|
79
|
-
readonly
|
|
79
|
+
readonly reply: HTMLAnchorElement[];
|
|
80
80
|
readonly anchor: HTMLAnchorElement[];
|
|
81
81
|
readonly media: HTMLElement[];
|
|
82
82
|
}
|
package/markdown.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export namespace MarkdownParser {
|
|
|
87
87
|
BlockParser.MathBlockParser,
|
|
88
88
|
BlockParser.ExtensionParser,
|
|
89
89
|
BlockParser.BlockquoteParser,
|
|
90
|
+
BlockParser.ReplyParser,
|
|
90
91
|
BlockParser.ParagraphParser,
|
|
91
92
|
]> {
|
|
92
93
|
}
|
|
@@ -550,65 +551,66 @@ export namespace MarkdownParser {
|
|
|
550
551
|
}
|
|
551
552
|
}
|
|
552
553
|
}
|
|
553
|
-
export interface
|
|
554
|
+
export interface ReplyParser extends
|
|
555
|
+
// >>1
|
|
556
|
+
// > text
|
|
554
557
|
// abc
|
|
555
|
-
Block<'
|
|
558
|
+
Block<'reply'>,
|
|
556
559
|
Parser<HTMLParagraphElement, Context, [
|
|
557
|
-
ParagraphParser.MentionParser,
|
|
558
560
|
Parser<string | HTMLElement, Context, [
|
|
559
|
-
|
|
561
|
+
ReplyParser.CiteParser,
|
|
562
|
+
ReplyParser.QuoteParser,
|
|
563
|
+
]>,
|
|
564
|
+
Parser<string | HTMLElement, Context, [
|
|
565
|
+
ReplyParser.QuoteParser,
|
|
560
566
|
InlineParser,
|
|
561
567
|
]>,
|
|
562
568
|
]> {
|
|
563
569
|
}
|
|
564
|
-
export namespace
|
|
565
|
-
export interface
|
|
566
|
-
|
|
567
|
-
// > text
|
|
568
|
-
Block<'paragraph/mention'>,
|
|
570
|
+
export namespace ReplyParser {
|
|
571
|
+
export interface CiteParser extends
|
|
572
|
+
Block<'reply/cite'>,
|
|
569
573
|
Parser<HTMLSpanElement | HTMLBRElement, Context, [
|
|
570
|
-
|
|
571
|
-
|
|
574
|
+
SourceParser.StrParser,
|
|
575
|
+
InlineParser.AutolinkParser.AnchorParser,
|
|
572
576
|
]> {
|
|
573
577
|
}
|
|
574
|
-
export
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
578
|
+
export interface QuoteParser extends
|
|
579
|
+
Block<'reply/quote'>,
|
|
580
|
+
Parser<HTMLSpanElement | HTMLBRElement, Context, [
|
|
581
|
+
QuoteParser.BlockParser,
|
|
582
|
+
QuoteParser.PlaceholderParser,
|
|
583
|
+
]> {
|
|
584
|
+
}
|
|
585
|
+
export namespace QuoteParser {
|
|
586
|
+
export interface BlockParser extends
|
|
587
|
+
Block<'reply/quote/block'>,
|
|
588
|
+
Parser<string | HTMLElement, Context, [
|
|
589
|
+
TextParser,
|
|
580
590
|
]> {
|
|
581
591
|
}
|
|
582
|
-
export interface
|
|
583
|
-
Block<'
|
|
584
|
-
Parser<
|
|
585
|
-
|
|
586
|
-
|
|
592
|
+
export interface TextParser extends
|
|
593
|
+
Block<'reply/quote/text'>,
|
|
594
|
+
Parser<string | HTMLElement, Context, [
|
|
595
|
+
InlineParser.MathParser,
|
|
596
|
+
AutolinkParser,
|
|
587
597
|
]> {
|
|
588
598
|
}
|
|
589
|
-
export
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
]> {
|
|
595
|
-
}
|
|
596
|
-
export interface TextParser extends
|
|
597
|
-
Block<'paragraph/mention/quote/text'>,
|
|
598
|
-
Parser<string | HTMLElement, Context, [
|
|
599
|
-
InlineParser.MathParser,
|
|
600
|
-
AutolinkParser,
|
|
601
|
-
]> {
|
|
602
|
-
}
|
|
603
|
-
export interface PlaceholderParser extends
|
|
604
|
-
Block<'paragraph/mention/quote/placeholder'>,
|
|
605
|
-
Parser<string | HTMLElement, Context, [
|
|
606
|
-
SourceParser.StrParser,
|
|
607
|
-
]> {
|
|
608
|
-
}
|
|
599
|
+
export interface PlaceholderParser extends
|
|
600
|
+
Block<'reply/quote/placeholder'>,
|
|
601
|
+
Parser<string | HTMLElement, Context, [
|
|
602
|
+
SourceParser.StrParser,
|
|
603
|
+
]> {
|
|
609
604
|
}
|
|
610
605
|
}
|
|
611
606
|
}
|
|
607
|
+
export interface ParagraphParser extends
|
|
608
|
+
// abc
|
|
609
|
+
Block<'paragraph'>,
|
|
610
|
+
Parser<HTMLParagraphElement, Context, [
|
|
611
|
+
InlineParser,
|
|
612
|
+
]> {
|
|
613
|
+
}
|
|
612
614
|
}
|
|
613
615
|
export interface InlineParser extends
|
|
614
616
|
Markdown<'inline'>,
|
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.232.0",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -1918,9 +1918,9 @@
|
|
|
1918
1918
|
"dev": true
|
|
1919
1919
|
},
|
|
1920
1920
|
"caniuse-lite": {
|
|
1921
|
-
"version": "1.0.
|
|
1922
|
-
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.
|
|
1923
|
-
"integrity": "sha512-
|
|
1921
|
+
"version": "1.0.30001314",
|
|
1922
|
+
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001314.tgz",
|
|
1923
|
+
"integrity": "sha512-0zaSO+TnCHtHJIbpLroX7nsD+vYuOVjl3uzFbJO1wMVbuveJA0RK2WcQA9ZUIOiO0/ArMiMgHJLxfEZhQiC0kw==",
|
|
1924
1924
|
"dev": true
|
|
1925
1925
|
},
|
|
1926
1926
|
"chalk": {
|
|
@@ -3024,9 +3024,9 @@
|
|
|
3024
3024
|
"dev": true
|
|
3025
3025
|
},
|
|
3026
3026
|
"electron-to-chromium": {
|
|
3027
|
-
"version": "1.4.
|
|
3028
|
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.
|
|
3029
|
-
"integrity": "sha512-
|
|
3027
|
+
"version": "1.4.77",
|
|
3028
|
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.77.tgz",
|
|
3029
|
+
"integrity": "sha512-fiDxw8mO9Ph1Z0bjX2sFTPpi0J0QkOiwOJF+5Q0J0baNc/F9lLePAvDPlnoxvbUYYMizqrKPeotRRkJ9LtxAew==",
|
|
3030
3030
|
"dev": true
|
|
3031
3031
|
},
|
|
3032
3032
|
"elliptic": {
|
|
@@ -3243,14 +3243,14 @@
|
|
|
3243
3243
|
}
|
|
3244
3244
|
},
|
|
3245
3245
|
"es5-ext": {
|
|
3246
|
-
"version": "0.10.
|
|
3247
|
-
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.
|
|
3248
|
-
"integrity": "sha512-
|
|
3246
|
+
"version": "0.10.56",
|
|
3247
|
+
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.56.tgz",
|
|
3248
|
+
"integrity": "sha512-YUhqzoMnIjMW5y8FzaMxsCu0eWCwq32GrlwhOhbQmL5OiZReWFm/KvRiYuvqf3CaG/zZ36Kyb4KfVe674cafCQ==",
|
|
3249
3249
|
"dev": true,
|
|
3250
3250
|
"requires": {
|
|
3251
|
-
"es6-iterator": "
|
|
3252
|
-
"es6-symbol": "
|
|
3253
|
-
"next-tick": "
|
|
3251
|
+
"es6-iterator": "^2.0.3",
|
|
3252
|
+
"es6-symbol": "^3.1.3",
|
|
3253
|
+
"next-tick": "^1.1.0"
|
|
3254
3254
|
}
|
|
3255
3255
|
},
|
|
3256
3256
|
"es6-iterator": {
|
|
@@ -7896,9 +7896,9 @@
|
|
|
7896
7896
|
"dev": true
|
|
7897
7897
|
},
|
|
7898
7898
|
"next-tick": {
|
|
7899
|
-
"version": "1.
|
|
7900
|
-
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.
|
|
7901
|
-
"integrity": "
|
|
7899
|
+
"version": "1.1.0",
|
|
7900
|
+
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
|
|
7901
|
+
"integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==",
|
|
7902
7902
|
"dev": true
|
|
7903
7903
|
},
|
|
7904
7904
|
"nice-try": {
|
package/package.json
CHANGED
|
@@ -127,7 +127,7 @@ function attributes(source: string) {
|
|
|
127
127
|
? { 'data-highlight-level': +highlight! > 1 ? highlight : undefined }
|
|
128
128
|
: {
|
|
129
129
|
'data-invalid-syntax': 'table',
|
|
130
|
-
'data-invalid-type': '
|
|
130
|
+
'data-invalid-type': 'syntax',
|
|
131
131
|
'data-invalid-description': 'Too much highlight level.',
|
|
132
132
|
},
|
|
133
133
|
};
|
|
@@ -28,28 +28,20 @@ describe('Unit: parser/block/paragraph', () => {
|
|
|
28
28
|
assert.deepStrictEqual(inspect(parser(' a')), [['<p>a</p>'], '']);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
it('
|
|
32
|
-
assert.deepStrictEqual(inspect(parser('>>1')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span></p>'], '']);
|
|
33
|
-
assert.deepStrictEqual(inspect(parser('>>1\na')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br>a</p>'], '']);
|
|
34
|
-
assert.deepStrictEqual(inspect(parser('>>1\na\n>>2')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br>a<br><a href="?comment=2" class="anchor">>>2</a></p>'], '']);
|
|
35
|
-
assert.deepStrictEqual(inspect(parser('>>1\n>>2')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="cite">><a href="?comment=2" class="anchor" data-depth="1">>2</a></span></p>'], '']);
|
|
36
|
-
assert.deepStrictEqual(inspect(parser('>>1\n> a')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a</span></p>'], '']);
|
|
37
|
-
assert.deepStrictEqual(inspect(parser('>>1\n> a\nb')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a</span><br>b</p>'], '']);
|
|
38
|
-
assert.deepStrictEqual(inspect(parser('>>1\n> a\n>>2')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a</span><br><span class="cite">><a href="?comment=2" class="anchor" data-depth="1">>2</a></span></p>'], '']);
|
|
39
|
-
assert.deepStrictEqual(inspect(parser('>>1\n> a\n>> b')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a<br>>> b</span></p>'], '']);
|
|
31
|
+
it('anchor', () => {
|
|
40
32
|
assert.deepStrictEqual(inspect(parser('>>1 a\nb')), [['<p><a href="?comment=1" class="anchor">>>1</a> a<br>b</p>'], '']);
|
|
41
33
|
assert.deepStrictEqual(inspect(parser('>>1 a\n>>2')), [['<p><a href="?comment=1" class="anchor">>>1</a> a<br><a href="?comment=2" class="anchor">>>2</a></p>'], '']);
|
|
42
34
|
assert.deepStrictEqual(inspect(parser('>>1 a\n>>b')), [['<p><a href="?comment=1" class="anchor">>>1</a> a<br><a href="?comment=b" class="anchor">>>b</a></p>'], '']);
|
|
43
|
-
assert.deepStrictEqual(inspect(parser('>>1 a\n>> b')), [['<p><a href="?comment=1" class="anchor">>>1</a> a<br
|
|
35
|
+
assert.deepStrictEqual(inspect(parser('>>1 a\n>> b')), [['<p><a href="?comment=1" class="anchor">>>1</a> a<br>>> b</p>'], '']);
|
|
44
36
|
assert.deepStrictEqual(inspect(parser('>>11.')), [['<p><a href="?comment=11" class="anchor">>>11</a>.</p>'], '']);
|
|
45
37
|
assert.deepStrictEqual(inspect(parser('>>11 a')), [['<p><a href="?comment=11" class="anchor">>>11</a> a</p>'], '']);
|
|
46
38
|
assert.deepStrictEqual(inspect(parser('>>>11 a')), [['<p>><a href="?comment=11" class="anchor">>>11</a> a</p>'], '']);
|
|
47
|
-
assert.deepStrictEqual(inspect(parser('>> a\n>>1')), [['<p
|
|
39
|
+
assert.deepStrictEqual(inspect(parser('>> a\n>>1')), [['<p>>> a<br><a href="?comment=1" class="anchor">>>1</a></p>'], '']);
|
|
48
40
|
assert.deepStrictEqual(inspect(parser('a>>1')), [['<p>a<a href="?comment=1" class="anchor">>>1</a></p>'], '']);
|
|
49
41
|
assert.deepStrictEqual(inspect(parser('a >>1')), [['<p>a <a href="?comment=1" class="anchor">>>1</a></p>'], '']);
|
|
50
42
|
assert.deepStrictEqual(inspect(parser('a\n>>1')), [['<p>a<br><a href="?comment=1" class="anchor">>>1</a></p>'], '']);
|
|
51
43
|
assert.deepStrictEqual(inspect(parser('a\n>>1\nb')), [['<p>a<br><a href="?comment=1" class="anchor">>>1</a><br>b</p>'], '']);
|
|
52
|
-
assert.deepStrictEqual(inspect(parser('a\n>> b\nc')), [['<p>a<br
|
|
44
|
+
assert.deepStrictEqual(inspect(parser('a\n>> b\nc')), [['<p>a<br>>> b<br>c</p>'], '']);
|
|
53
45
|
assert.deepStrictEqual(inspect(parser(' >>1')), [['<p><a href="?comment=1" class="anchor">>>1</a></p>'], '']);
|
|
54
46
|
assert.deepStrictEqual(inspect(parser(' >>>1')), [['<p>><a href="?comment=1" class="anchor">>>1</a></p>'], '']);
|
|
55
47
|
});
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { ParagraphParser } from '../block';
|
|
2
|
-
import { union,
|
|
3
|
-
import { mention } from './paragraph/mention';
|
|
4
|
-
import { quote, syntax as delimiter } from './paragraph/mention/quote';
|
|
2
|
+
import { union, some, block, trim, fmap } from '../../combinator';
|
|
5
3
|
import { inline } from '../inline';
|
|
6
|
-
import { anyline } from '../source';
|
|
7
4
|
import { localize } from '../locale';
|
|
8
5
|
import { visualize } from '../util';
|
|
9
6
|
import { html, defrag } from 'typed-dom';
|
|
10
|
-
import { push, pop } from 'spica/array';
|
|
11
7
|
|
|
12
8
|
export const paragraph: ParagraphParser = block(localize(fmap(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
some(union([
|
|
16
|
-
quote,
|
|
17
|
-
fmap(
|
|
18
|
-
rewrite(
|
|
19
|
-
some(anyline, delimiter),
|
|
20
|
-
trim(visualize(some(inline)))),
|
|
21
|
-
ns => push(ns, [html('br')])),
|
|
22
|
-
])),
|
|
23
|
-
]),
|
|
24
|
-
ns => [html('p', defrag(pop(ns)[0]))])));
|
|
9
|
+
trim(visualize(some(union([inline])))),
|
|
10
|
+
ns => [html('p', defrag(ns))])));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cite } from './cite';
|
|
2
|
-
import { some } from '
|
|
3
|
-
import { inspect } from '
|
|
2
|
+
import { some } from '../../../combinator';
|
|
3
|
+
import { inspect } from '../../../debug.test';
|
|
4
4
|
|
|
5
|
-
describe('Unit: parser/block/
|
|
5
|
+
describe('Unit: parser/block/reply/cite', () => {
|
|
6
6
|
describe('cite', () => {
|
|
7
7
|
const parser = (source: string) => some(cite)(source, {});
|
|
8
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { tails, line, validate, creator, reverse, fmap } from '
|
|
3
|
-
import { anchor } from '
|
|
4
|
-
import { str } from '
|
|
1
|
+
import { ReplyParser } from '../../block';
|
|
2
|
+
import { tails, line, validate, creator, reverse, fmap } from '../../../combinator';
|
|
3
|
+
import { anchor } from '../../inline/autolink/anchor';
|
|
4
|
+
import { str } from '../../source';
|
|
5
5
|
import { html, define, defrag } from 'typed-dom';
|
|
6
6
|
|
|
7
|
-
export const cite:
|
|
7
|
+
export const cite: ReplyParser.CiteParser = creator(line(fmap(validate(
|
|
8
8
|
'>>',
|
|
9
9
|
reverse(tails([
|
|
10
10
|
str(/^>*(?=>>)/),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { quote } from './quote';
|
|
2
|
-
import { some } from '
|
|
3
|
-
import { inspect } from '
|
|
2
|
+
import { some } from '../../../combinator';
|
|
3
|
+
import { inspect } from '../../../debug.test';
|
|
4
4
|
|
|
5
|
-
describe('Unit: parser/block/
|
|
5
|
+
describe('Unit: parser/block/reply/quote', () => {
|
|
6
6
|
describe('quote', () => {
|
|
7
7
|
const parser = (source: string) => some(quote)(source, {});
|
|
8
8
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { eval } from '
|
|
3
|
-
import { union, some, block, line, validate, rewrite, creator, lazy, fmap } from '
|
|
4
|
-
import { math } from '
|
|
5
|
-
import { str, anyline } from '
|
|
6
|
-
import { autolink } from '
|
|
1
|
+
import { ReplyParser } from '../../block';
|
|
2
|
+
import { eval } from '../../../combinator/data/parser';
|
|
3
|
+
import { union, some, block, line, validate, rewrite, creator, lazy, fmap } from '../../../combinator';
|
|
4
|
+
import { math } from '../../inline/math';
|
|
5
|
+
import { str, anyline } from '../../source';
|
|
6
|
+
import { autolink } from '../../autolink';
|
|
7
7
|
import { html, defrag } from 'typed-dom';
|
|
8
8
|
|
|
9
9
|
export const syntax = /^>+(?=[^\S\n])|^>(?=[^\s>])|^>+(?=[^\s>])(?![0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:]))/;
|
|
10
10
|
|
|
11
|
-
export const quote:
|
|
11
|
+
export const quote: ReplyParser.QuoteParser = lazy(() => creator(block(fmap(validate(
|
|
12
12
|
'>',
|
|
13
13
|
union([
|
|
14
14
|
rewrite(
|
|
@@ -33,7 +33,7 @@ export const quote: ParagraphParser.MentionParser.QuoteParser = lazy(() => creat
|
|
|
33
33
|
]),
|
|
34
34
|
false)));
|
|
35
35
|
|
|
36
|
-
const qblock:
|
|
36
|
+
const qblock: ReplyParser.QuoteParser.BlockParser = (source, context) => {
|
|
37
37
|
source = source.replace(/\n$/, '');
|
|
38
38
|
const lines = source.match(/^.*\n?/mg)!;
|
|
39
39
|
assert(lines);
|
|
@@ -69,7 +69,7 @@ const qblock: ParagraphParser.MentionParser.QuoteParser.BlockParser = (source, c
|
|
|
69
69
|
return [defrag(nodes), ''];
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
const text:
|
|
72
|
+
const text: ReplyParser.QuoteParser.TextParser = union([
|
|
73
73
|
math,
|
|
74
74
|
autolink,
|
|
75
75
|
]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { reply } from './reply';
|
|
2
|
+
import { some } from '../../combinator';
|
|
3
|
+
import { inspect } from '../../debug.test';
|
|
4
|
+
|
|
5
|
+
describe('Unit: parser/block/reply', () => {
|
|
6
|
+
describe('reply', () => {
|
|
7
|
+
const parser = (source: string) => some(reply)(source, {});
|
|
8
|
+
|
|
9
|
+
it('basic', () => {
|
|
10
|
+
assert.deepStrictEqual(inspect(parser('>>1')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span></p>'], '']);
|
|
11
|
+
assert.deepStrictEqual(inspect(parser('>>1\na')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br>a</p>'], '']);
|
|
12
|
+
assert.deepStrictEqual(inspect(parser('>>1\na\n>>2')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br>a<br><a href="?comment=2" class="anchor">>>2</a></p>'], '']);
|
|
13
|
+
assert.deepStrictEqual(inspect(parser('>>1\n>>2')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="cite">><a href="?comment=2" class="anchor" data-depth="1">>2</a></span></p>'], '']);
|
|
14
|
+
assert.deepStrictEqual(inspect(parser('>>1\n> a')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a</span></p>'], '']);
|
|
15
|
+
assert.deepStrictEqual(inspect(parser('>>1\n> a\nb')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a</span><br>b</p>'], '']);
|
|
16
|
+
assert.deepStrictEqual(inspect(parser('>>1\n> a\n>>2')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a</span><br><span class="cite">><a href="?comment=2" class="anchor" data-depth="1">>2</a></span></p>'], '']);
|
|
17
|
+
assert.deepStrictEqual(inspect(parser('>>1\n> a\n>> b')), [['<p><span class="cite">><a href="?comment=1" class="anchor" data-depth="1">>1</a></span><br><span class="quote">> a<br>>> b</span></p>'], '']);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReplyParser } from '../block';
|
|
2
|
+
import { inits, subsequence, some, block, validate, rewrite, trim, fmap } from '../../combinator';
|
|
3
|
+
import { cite } from './reply/cite';
|
|
4
|
+
import { quote, syntax as delimiter } from './reply/quote';
|
|
5
|
+
import { inline } from '../inline';
|
|
6
|
+
import { anyline } from '../source';
|
|
7
|
+
import { localize } from '../locale';
|
|
8
|
+
import { visualize } from '../util';
|
|
9
|
+
import { html, defrag } from 'typed-dom';
|
|
10
|
+
import { push, pop } from 'spica/array';
|
|
11
|
+
|
|
12
|
+
export const reply: ReplyParser = block(validate('>', localize(fmap(
|
|
13
|
+
some(inits([
|
|
14
|
+
some(inits([
|
|
15
|
+
cite,
|
|
16
|
+
quote,
|
|
17
|
+
])),
|
|
18
|
+
subsequence([
|
|
19
|
+
some(quote),
|
|
20
|
+
fmap(
|
|
21
|
+
rewrite(
|
|
22
|
+
some(anyline, delimiter),
|
|
23
|
+
trim(visualize(some(inline)))),
|
|
24
|
+
ns => push(ns, [html('br')])),
|
|
25
|
+
]),
|
|
26
|
+
])),
|
|
27
|
+
ns => [html('p', defrag(pop(ns)[0]))]))));
|
package/src/parser/block.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { blockquote } from './block/blockquote';
|
|
|
13
13
|
import { codeblock } from './block/codeblock';
|
|
14
14
|
import { mathblock } from './block/mathblock';
|
|
15
15
|
import { extension } from './block/extension';
|
|
16
|
+
import { reply } from './block/reply';
|
|
16
17
|
import { paragraph } from './block/paragraph';
|
|
17
18
|
import { html } from 'typed-dom';
|
|
18
19
|
import { rnd0Z } from 'spica/random';
|
|
@@ -29,6 +30,7 @@ export import CodeBlockParser = BlockParser.CodeBlockParser;
|
|
|
29
30
|
export import MathBlockParser = BlockParser.MathBlockParser;
|
|
30
31
|
export import ExtensionParser = BlockParser.ExtensionParser;
|
|
31
32
|
export import BlockquoteParser = BlockParser.BlockquoteParser;
|
|
33
|
+
export import ReplyParser = BlockParser.ReplyParser;
|
|
32
34
|
export import ParagraphParser = BlockParser.ParagraphParser;
|
|
33
35
|
|
|
34
36
|
export const block: BlockParser = creator(error(
|
|
@@ -46,6 +48,7 @@ export const block: BlockParser = creator(error(
|
|
|
46
48
|
mathblock,
|
|
47
49
|
extension,
|
|
48
50
|
blockquote,
|
|
51
|
+
reply,
|
|
49
52
|
paragraph
|
|
50
53
|
]))));
|
|
51
54
|
|
package/src/parser/util.ts
CHANGED
|
@@ -229,7 +229,7 @@ export function stringify(nodes: readonly (HTMLElement | string)[]): string {
|
|
|
229
229
|
}
|
|
230
230
|
else {
|
|
231
231
|
assert(!node.matches('br') && !node.querySelector('br'));
|
|
232
|
-
//
|
|
232
|
+
// NOTE: Doesn't reflect line breaks.
|
|
233
233
|
acc += node.innerText;
|
|
234
234
|
}
|
|
235
235
|
}
|
package/src/util/info.test.ts
CHANGED
package/src/util/info.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Info } from '../..';
|
|
|
2
2
|
import { scope } from './scope';
|
|
3
3
|
|
|
4
4
|
export function info(source: DocumentFragment | HTMLElement | ShadowRoot): Info {
|
|
5
|
-
const match = scope(source, '
|
|
5
|
+
const match = scope(source, '.invalid');
|
|
6
6
|
return {
|
|
7
7
|
url: find<HTMLAnchorElement>('a:not(.email):not(.account):not(.channel):not(.hashtag):not(.hashnum):not(.anchor)')
|
|
8
8
|
.filter(el => ['http:', 'https:'].includes(el.protocol)),
|
|
@@ -13,7 +13,7 @@ export function info(source: DocumentFragment | HTMLElement | ShadowRoot): Info
|
|
|
13
13
|
channel: find('a.channel'),
|
|
14
14
|
hashtag: find('a.hashtag'),
|
|
15
15
|
hashnum: find('a.hashnum'),
|
|
16
|
-
|
|
16
|
+
reply: find('.cite > a.anchor'),
|
|
17
17
|
anchor: find(':not(.cite) > a.anchor'),
|
|
18
18
|
media: find('.media[data-src]'),
|
|
19
19
|
};
|
package/src/util/quote.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { exec } from '../combinator/data/parser';
|
|
2
|
-
import { cite } from '../parser/block/
|
|
2
|
+
import { cite } from '../parser/block/reply/cite';
|
|
3
3
|
import { define } from 'typed-dom';
|
|
4
4
|
|
|
5
5
|
export function quote(anchor: string, range: Range): string {
|
package/src/util/scope.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { undefined, WeakMap } from 'spica/global';
|
|
|
2
2
|
|
|
3
3
|
export function scope(
|
|
4
4
|
base: DocumentFragment | HTMLElement | ShadowRoot,
|
|
5
|
-
|
|
5
|
+
filter: string = '',
|
|
6
|
+
bound: string = `${'id' in base && base.id ? `#${base.id}, ` : ''}section, article, aside, blockquote, pre, .quote, .math, .media`,
|
|
6
7
|
): (el: Element) => boolean {
|
|
8
|
+
bound += filter && `, ${filter}`;
|
|
7
9
|
const memory = new WeakMap<Node, boolean>();
|
|
8
10
|
const context = 'id' in base && base.closest(bound) || null;
|
|
9
11
|
return el => {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ParagraphParser } from '../../block';
|
|
2
|
-
import { inits, some, validate } from '../../../combinator';
|
|
3
|
-
import { cite } from './mention/cite';
|
|
4
|
-
import { quote } from './mention/quote';
|
|
5
|
-
|
|
6
|
-
export const mention: ParagraphParser.MentionParser = validate('>', inits([
|
|
7
|
-
some(cite),
|
|
8
|
-
quote,
|
|
9
|
-
]));
|