securemark 0.270.1 → 0.270.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/index.js +11 -10
- package/package.json +1 -1
- package/src/parser/block/dlist.ts +6 -6
- package/src/parser/block/extension/figure.ts +4 -4
- package/src/parser/block/heading.ts +5 -5
- package/src/parser/block/paragraph.ts +4 -4
- package/src/parser/block/reply.ts +5 -5
- package/src/parser/visibility.ts +3 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.270.
|
|
1
|
+
/*! securemark v0.270.2 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"));
|
|
@@ -4465,8 +4465,8 @@ const visibility_1 = __webpack_require__(7618);
|
|
|
4465
4465
|
const array_1 = __webpack_require__(8112);
|
|
4466
4466
|
const dom_1 = __webpack_require__(3252);
|
|
4467
4467
|
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(256 /* State.annotation */ | 128 /* State.reference */ | 64 /* State.index */ | 32 /* State.label */ | 16 /* State.link */ | 8 /* State.media */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))])));
|
|
4468
|
-
const term = (0, combinator_1.creation)(1, false, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, visibility_1.visualize)((0, visibility_1.
|
|
4469
|
-
const desc = (0, combinator_1.creation)(1, false, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, visibility_1.visualize)((0, combinator_1.
|
|
4468
|
+
const term = (0, combinator_1.creation)(1, false, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, visibility_1.visualize)((0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(ns)))]))));
|
|
4469
|
+
const desc = (0, combinator_1.creation)(1, false, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), true), ns => [(0, dom_1.html)('dd', (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(ns)))]), false));
|
|
4470
4470
|
function fillTrailingDescription(es) {
|
|
4471
4471
|
return es.length > 0 && es[es.length - 1].tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
|
|
4472
4472
|
}
|
|
@@ -4701,11 +4701,11 @@ const dom_1 = __webpack_require__(3252);
|
|
|
4701
4701
|
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n])?(?=\[?\$)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
|
|
4702
4702
|
// All parsers which can include closing terms.
|
|
4703
4703
|
(0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, [])));
|
|
4704
|
-
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, combinator_1.state)(8 /* State.media */, (0, visibility_1.visualize)((0, visibility_1.
|
|
4704
|
+
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, combinator_1.state)(8 /* State.media */, (0, visibility_1.visualize)((0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline)))))])])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
|
|
4705
4705
|
class: 'figindex'
|
|
4706
4706
|
}), (0, dom_1.html)('span', {
|
|
4707
4707
|
class: 'figtext'
|
|
4708
|
-
}, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/, 300), ([body, overflow, closer, opener, delim], _, context) => [(0, dom_1.html)('pre', {
|
|
4708
|
+
}, (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(caption)))]), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/, 300), ([body, overflow, closer, opener, delim], _, context) => [(0, dom_1.html)('pre', {
|
|
4709
4709
|
class: 'invalid',
|
|
4710
4710
|
translate: 'no',
|
|
4711
4711
|
'data-invalid-syntax': 'figure',
|
|
@@ -5148,12 +5148,12 @@ const dom_1 = __webpack_require__(3252);
|
|
|
5148
5148
|
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(({
|
|
5149
5149
|
source
|
|
5150
5150
|
}) => [[source], ''])))));
|
|
5151
|
-
exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.state)(256 /* State.annotation */ | 128 /* State.reference */ | 64 /* State.index */ | 32 /* State.label */ | 16 /* State.link */ | 8 /* State.media */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, visibility_1.visualize)((0, visibility_1.
|
|
5151
|
+
exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.state)(256 /* State.annotation */ | 128 /* State.reference */ | 64 /* State.index */ | 32 /* State.label */ | 16 /* State.link */ | 8 /* State.media */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, visibility_1.visualize)((0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(2 /* State.autolink */, (0, visibility_1.visualize)((0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(ns))) : (0, dom_1.html)(`h6`, {
|
|
5152
5152
|
class: 'invalid',
|
|
5153
5153
|
'data-invalid-syntax': 'heading',
|
|
5154
5154
|
'data-invalid-type': 'syntax',
|
|
5155
5155
|
'data-invalid-message': 'Heading level must be up to 6'
|
|
5156
|
-
}, (0, dom_1.defrag)(ns))]))))));
|
|
5156
|
+
}, (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(ns)))]))))));
|
|
5157
5157
|
|
|
5158
5158
|
/***/ }),
|
|
5159
5159
|
|
|
@@ -5384,7 +5384,7 @@ const combinator_1 = __webpack_require__(2087);
|
|
|
5384
5384
|
const inline_1 = __webpack_require__(1160);
|
|
5385
5385
|
const visibility_1 = __webpack_require__(7618);
|
|
5386
5386
|
const dom_1 = __webpack_require__(3252);
|
|
5387
|
-
exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.convert)(source => `\r${source}`, (0, visibility_1.visualize)((0, combinator_1.
|
|
5387
|
+
exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.convert)(source => `\r${source}`, (0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(ns)))]));
|
|
5388
5388
|
|
|
5389
5389
|
/***/ }),
|
|
5390
5390
|
|
|
@@ -5412,7 +5412,7 @@ const dom_1 = __webpack_require__(3252);
|
|
|
5412
5412
|
対象をURLで指定すべき(引用ツリーにルートを追加する)場合はない
|
|
5413
5413
|
対象と引用は1:N(分割)、N:1(統合)のみ可能、N:N(混合)は不可能
|
|
5414
5414
|
*/
|
|
5415
|
-
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, visibility_1.visualize)((0, combinator_1.
|
|
5415
|
+
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, visibility_1.visualize)((0, combinator_1.some)(inline_1.inline))), ns => (0, array_1.push)(ns, [(0, dom_1.html)('br')]))]))]), ns => [(0, dom_1.html)('p', (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])));
|
|
5416
5416
|
|
|
5417
5417
|
/***/ }),
|
|
5418
5418
|
|
|
@@ -7588,7 +7588,7 @@ exports.stringify = stringify;
|
|
|
7588
7588
|
Object.defineProperty(exports, "__esModule", ({
|
|
7589
7589
|
value: true
|
|
7590
7590
|
}));
|
|
7591
|
-
exports.trimNodeEnd = exports.trimNode = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.blankWith = exports.regBlankStart = exports.visualize = void 0;
|
|
7591
|
+
exports.trimNodeEnd = exports.trimNode = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.blankWith = exports.regBlankStart = exports.visualize = void 0;
|
|
7592
7592
|
const parser_1 = __webpack_require__(6728);
|
|
7593
7593
|
const combinator_1 = __webpack_require__(2087);
|
|
7594
7594
|
const htmlentity_1 = __webpack_require__(1562);
|
|
@@ -7724,6 +7724,7 @@ exports.trimBlank = trimBlank;
|
|
|
7724
7724
|
function trimBlankStart(parser) {
|
|
7725
7725
|
return (0, combinator_1.convert)((0, memoize_1.reduce)(source => source.replace(exports.regBlankStart, '')), parser);
|
|
7726
7726
|
}
|
|
7727
|
+
exports.trimBlankStart = trimBlankStart;
|
|
7727
7728
|
function trimBlankEnd(parser) {
|
|
7728
7729
|
return (0, combinator_1.fmap)(parser, trimNodeEnd);
|
|
7729
7730
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DListParser } from '../block';
|
|
2
|
-
import { union, inits, some, creation, state, block, line, validate, rewrite, open,
|
|
2
|
+
import { union, inits, some, creation, state, block, line, validate, rewrite, open, lazy, fmap } from '../../combinator';
|
|
3
3
|
import { inline, indexee, indexer } from '../inline';
|
|
4
4
|
import { anyline } from '../source';
|
|
5
5
|
import { State } from '../context';
|
|
6
|
-
import { visualize,
|
|
6
|
+
import { visualize, trimBlankStart, trimNodeEnd } from '../visibility';
|
|
7
7
|
import { push } from 'spica/array';
|
|
8
8
|
import { html, defrag } from 'typed-dom/dom';
|
|
9
9
|
|
|
@@ -18,17 +18,17 @@ export const dlist: DListParser = lazy(() => block(fmap(validate(
|
|
|
18
18
|
|
|
19
19
|
const term: DListParser.TermParser = creation(1, false, line(indexee(fmap(open(
|
|
20
20
|
/^~[^\S\n]+(?=\S)/,
|
|
21
|
-
visualize(
|
|
21
|
+
visualize(trimBlankStart(some(union([indexer, inline])))),
|
|
22
22
|
true),
|
|
23
|
-
ns => [html('dt', defrag(ns))]))));
|
|
23
|
+
ns => [html('dt', trimNodeEnd(defrag(ns)))]))));
|
|
24
24
|
|
|
25
25
|
const desc: DListParser.DescriptionParser = creation(1, false, block(fmap(open(
|
|
26
26
|
/^:[^\S\n]+(?=\S)|/,
|
|
27
27
|
rewrite(
|
|
28
28
|
some(anyline, /^[~:][^\S\n]+\S/),
|
|
29
|
-
visualize(
|
|
29
|
+
visualize(some(union([inline])))),
|
|
30
30
|
true),
|
|
31
|
-
ns => [html('dd', defrag(ns))]),
|
|
31
|
+
ns => [html('dd', trimNodeEnd(defrag(ns)))]),
|
|
32
32
|
false));
|
|
33
33
|
|
|
34
34
|
function fillTrailingDescription(es: HTMLElement[]): HTMLElement[] {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExtensionParser } from '../../block';
|
|
2
|
-
import { union, inits, sequence, some, state, block, line, fence, rewrite, close, match, convert,
|
|
2
|
+
import { union, inits, sequence, some, state, block, line, fence, rewrite, close, match, convert, fallback, fmap } from '../../../combinator';
|
|
3
3
|
import { str, contentline, emptyline } from '../../source';
|
|
4
4
|
import { label, segment as seg_label } from '../../inline/extension/label';
|
|
5
5
|
import { ulist } from '../ulist';
|
|
@@ -13,7 +13,7 @@ import { blockquote, segment as seg_blockquote } from '../blockquote';
|
|
|
13
13
|
import { placeholder, segment_ as seg_placeholder } from './placeholder';
|
|
14
14
|
import { inline, media, shortmedia } from '../../inline';
|
|
15
15
|
import { State } from '../../context';
|
|
16
|
-
import { visualize,
|
|
16
|
+
import { visualize, trimBlankStart, trimNodeEnd } from '../../visibility';
|
|
17
17
|
import { memoize } from 'spica/memoize';
|
|
18
18
|
import { html, defrag } from 'typed-dom/dom';
|
|
19
19
|
|
|
@@ -66,7 +66,7 @@ export const figure: FigureParser = block(fallback(rewrite(segment, fmap(
|
|
|
66
66
|
emptyline,
|
|
67
67
|
block(
|
|
68
68
|
state(State.media,
|
|
69
|
-
visualize(
|
|
69
|
+
visualize(trimBlankStart(some(inline))))),
|
|
70
70
|
]),
|
|
71
71
|
])),
|
|
72
72
|
([label, param, content, ...caption]: [HTMLAnchorElement, string, ...HTMLElement[]]) => [
|
|
@@ -75,7 +75,7 @@ export const figure: FigureParser = block(fallback(rewrite(segment, fmap(
|
|
|
75
75
|
[
|
|
76
76
|
html('figcaption', [
|
|
77
77
|
html('span', { class: 'figindex' }),
|
|
78
|
-
html('span', { class: 'figtext' }, defrag(caption)),
|
|
78
|
+
html('span', { class: 'figtext' }, trimNodeEnd(defrag(caption))),
|
|
79
79
|
]),
|
|
80
80
|
html('div', [content]),
|
|
81
81
|
])
|
|
@@ -3,7 +3,7 @@ import { union, some, state, block, line, validate, focus, rewrite, open, fmap }
|
|
|
3
3
|
import { inline, indexee, indexer } from '../inline';
|
|
4
4
|
import { str } from '../source';
|
|
5
5
|
import { State } from '../context';
|
|
6
|
-
import { visualize,
|
|
6
|
+
import { visualize, trimBlankStart, trimNodeEnd } from '../visibility';
|
|
7
7
|
import { html, defrag } from 'typed-dom/dom';
|
|
8
8
|
|
|
9
9
|
export const segment: HeadingParser.SegmentParser = block(validate('#', focus(
|
|
@@ -15,19 +15,19 @@ export const heading: HeadingParser = block(rewrite(segment,
|
|
|
15
15
|
line(indexee(fmap(union([
|
|
16
16
|
open(
|
|
17
17
|
str(/^##+/),
|
|
18
|
-
visualize(
|
|
18
|
+
visualize(trimBlankStart(some(union([indexer, inline])))), true),
|
|
19
19
|
open(
|
|
20
20
|
str('#'),
|
|
21
21
|
state(State.autolink,
|
|
22
|
-
visualize(
|
|
22
|
+
visualize(trimBlankStart(some(union([indexer, inline]))))), true),
|
|
23
23
|
]),
|
|
24
24
|
([h, ...ns]: [string, ...(HTMLElement | string)[]]) => [
|
|
25
25
|
h.length <= 6
|
|
26
|
-
? html(`h${h.length as 1}`, defrag(ns))
|
|
26
|
+
? html(`h${h.length as 1}`, trimNodeEnd(defrag(ns)))
|
|
27
27
|
: html(`h6`, {
|
|
28
28
|
class: 'invalid',
|
|
29
29
|
'data-invalid-syntax': 'heading',
|
|
30
30
|
'data-invalid-type': 'syntax',
|
|
31
31
|
'data-invalid-message': 'Heading level must be up to 6',
|
|
32
|
-
}, defrag(ns))
|
|
32
|
+
}, trimNodeEnd(defrag(ns)))
|
|
33
33
|
]))))));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ParagraphParser } from '../block';
|
|
2
|
-
import { union, some, block, convert,
|
|
2
|
+
import { union, some, block, convert, fmap } from '../../combinator';
|
|
3
3
|
import { inline } from '../inline';
|
|
4
|
-
import { visualize } from '../visibility';
|
|
4
|
+
import { visualize, trimNodeEnd } from '../visibility';
|
|
5
5
|
import { html, defrag } from 'typed-dom/dom';
|
|
6
6
|
|
|
7
7
|
export const paragraph: ParagraphParser = block(fmap(
|
|
8
8
|
convert(source => `\r${source}`,
|
|
9
|
-
visualize(
|
|
10
|
-
ns => [html('p', defrag(ns))]));
|
|
9
|
+
visualize(some(union([inline])))),
|
|
10
|
+
ns => [html('p', trimNodeEnd(defrag(ns)))]));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReplyParser } from '../block';
|
|
2
|
-
import { inits, subsequence, some, block, validate, rewrite,
|
|
2
|
+
import { inits, subsequence, some, block, validate, rewrite, fmap } from '../../combinator';
|
|
3
3
|
import { cite } from './reply/cite';
|
|
4
4
|
import { quote, syntax as delimiter } from './reply/quote';
|
|
5
5
|
import { inline } from '../inline';
|
|
6
6
|
import { anyline } from '../source';
|
|
7
|
-
import { visualize } from '../visibility';
|
|
8
|
-
import { push
|
|
7
|
+
import { visualize, trimNodeEnd } from '../visibility';
|
|
8
|
+
import { push } from 'spica/array';
|
|
9
9
|
import { html, defrag } from 'typed-dom/dom';
|
|
10
10
|
|
|
11
11
|
/*
|
|
@@ -25,8 +25,8 @@ export const reply: ReplyParser = block(validate('>', fmap(
|
|
|
25
25
|
some(quote),
|
|
26
26
|
fmap(rewrite(
|
|
27
27
|
some(anyline, delimiter),
|
|
28
|
-
visualize(
|
|
28
|
+
visualize(some(inline))),
|
|
29
29
|
ns => push(ns, [html('br')])),
|
|
30
30
|
])),
|
|
31
31
|
]),
|
|
32
|
-
ns => [html('p', defrag(
|
|
32
|
+
ns => [html('p', trimNodeEnd(defrag(ns)))])));
|
package/src/parser/visibility.ts
CHANGED
|
@@ -146,12 +146,13 @@ function isVisible(node: HTMLElement | string, strpos?: number): boolean {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
// デフラグ前の非効率な後方トリムを避けるため必要のない限りtrimBlankStart+trimNodeEndで処理する。
|
|
149
150
|
export function trimBlank<P extends Parser<HTMLElement | string>>(parser: P): P;
|
|
150
151
|
export function trimBlank<T extends HTMLElement | string>(parser: Parser<T>): Parser<T> {
|
|
151
152
|
return trimBlankStart(trimBlankEnd(parser));
|
|
152
153
|
}
|
|
153
|
-
function trimBlankStart<P extends Parser<unknown>>(parser: P): P;
|
|
154
|
-
function trimBlankStart<T>(parser: Parser<T>): Parser<T> {
|
|
154
|
+
export function trimBlankStart<P extends Parser<unknown>>(parser: P): P;
|
|
155
|
+
export function trimBlankStart<T>(parser: Parser<T>): Parser<T> {
|
|
155
156
|
return convert(
|
|
156
157
|
reduce(source => source.replace(regBlankStart, '')),
|
|
157
158
|
parser);
|