securemark 0.269.1 → 0.270.1

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.270.1
4
+
5
+ - Refactoring.
6
+
7
+ ## 0.270.0
8
+
9
+ - Change the operator precedence of double quotation to 3.
10
+
3
11
  ## 0.269.1
4
12
 
5
13
  - Refactoring.
package/README.md CHANGED
@@ -68,11 +68,11 @@ Secure markdown renderer working on browsers for user input data.
68
68
  |P| Operators |
69
69
  |-|------------------|
70
70
  |9| \n, \\\n |
71
- |8| `, " |
71
+ |8| ` |
72
72
  |6| (()), [[]], ${}$ |
73
73
  |5| \<tag>\</tag> |
74
74
  |4| [% %] |
75
- |3| $ |
75
+ |3| $, " |
76
76
  |2| (), [], {} |
77
77
  |1| _, *, ==, ++, ~~ |
78
78
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.269.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.270.1 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"));
@@ -2090,7 +2090,13 @@ exports.pcg32 = exports.xorshift = exports.unique = exports.rndAf = exports.rndA
2090
2090
  const bases = Object.freeze([...Array(7)].map((_, i) => 1 << i));
2091
2091
  const masks = Object.freeze(bases.map(radix => radix - 1));
2092
2092
  const dict0_ = [...[...Array(36)].map((_, i) => i.toString(36)), ...[...Array(36)].map((_, i) => i.toString(36).toUpperCase()).slice(-26), '-', '_'].join('');
2093
+
2094
+ // eslint-disable-next-line
2095
+
2093
2096
  const dictAz = [...[...Array(36)].map((_, i) => i.toString(36).toUpperCase()).slice(-26), ...[...Array(36)].map((_, i) => i.toString(36)).slice(-26)].join('');
2097
+
2098
+ // eslint-disable-next-line
2099
+
2094
2100
  exports.rnd16 = cons(16);
2095
2101
  exports.rnd32 = cons(32);
2096
2102
  exports.rnd62 = cons(62);
@@ -2391,7 +2397,10 @@ class URL {
2391
2397
  this.source = source;
2392
2398
  this.base = base;
2393
2399
  this.url = new format_1.ReadonlyURL(source, base);
2400
+
2401
+ //assert(this.href.startsWith(this.resource));
2394
2402
  }
2403
+
2395
2404
  get href() {
2396
2405
  return this.params?.toString().replace(/^(?=.)/, `${this.url.href.slice(0, -this.url.query.length - this.url.fragment.length || this.url.href.length)}?`).concat(this.fragment) ?? this.url.href;
2397
2406
  }
@@ -5744,9 +5753,7 @@ const combinator_1 = __webpack_require__(2087);
5744
5753
  const inline_1 = __webpack_require__(1160);
5745
5754
  const visibility_1 = __webpack_require__(7618);
5746
5755
  const dom_1 = __webpack_require__(3252);
5747
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(256 /* State.annotation */, false, (0, combinator_1.syntax)(0 /* Syntax.none */, 6, 1, 256 /* State.annotation */ | 8 /* State.media */, (0, visibility_1.startLoose)((0, combinator_1.context)({
5748
- delimiters: undefined
5749
- }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5756
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(256 /* State.annotation */, false, (0, combinator_1.syntax)(0 /* Syntax.none */, 6, 1, 256 /* State.annotation */ | 8 /* State.media */, (0, visibility_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]]), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5750
5757
  class: 'annotation'
5751
5758
  }, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
5752
5759
 
@@ -5978,7 +5985,7 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, comb
5978
5985
  class: 'paren'
5979
5986
  }, (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]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.syntax)(8 /* Syntax.bracket */, 2, 1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.syntax)(8 /* Syntax.bracket */, 2, 1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
5980
5987
  // Control media blinking in editing rather than control confusion of pairs of quote marks.
5981
- (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.syntax)(0 /* Syntax.none */, 8, 1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
5988
+ (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.syntax)(0 /* Syntax.none */, 3, 1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '"', [['"', 3]])), (0, source_1.str)('"'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
5982
5989
 
5983
5990
  /***/ }),
5984
5991
 
@@ -6103,7 +6110,7 @@ const indexee_1 = __webpack_require__(1269);
6103
6110
  const source_1 = __webpack_require__(6743);
6104
6111
  const visibility_1 = __webpack_require__(7618);
6105
6112
  const dom_1 = __webpack_require__(3252);
6106
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(64 /* State.index */, false, (0, combinator_1.syntax)(128 /* Syntax.index */, 2, 1, 502 /* State.linkers */ | 8 /* State.media */, (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)('|'), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
6113
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(64 /* State.index */, false, (0, combinator_1.syntax)(128 /* Syntax.index */, 2, 1, 502 /* State.linkers */ | 8 /* State.media */, (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)('|'), (0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, visibility_1.trimNodeEnd)((0, dom_1.defrag)(ns)))], rest])), ([el]) => [(0, dom_1.define)(el, {
6107
6114
  id: el.id ? null : undefined,
6108
6115
  class: 'index',
6109
6116
  href: el.id ? `#${el.id}` : undefined
@@ -6273,7 +6280,7 @@ const array_1 = __webpack_require__(8112);
6273
6280
  const dom_1 = __webpack_require__(3252);
6274
6281
  // Don't use the symbols already used: !#$%@&*+~=|
6275
6282
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6276
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.surround)((0, source_1.str)(/^\[[:^|]/), (0, combinator_1.syntax)(64 /* Syntax.placeholder */, 2, 1, 0 /* State.none */, (0, visibility_1.startTight)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 2]])))), (0, source_1.str)(']'), false, ([, bs], rest) => [[(0, dom_1.html)('span', {
6283
+ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.surround)((0, source_1.str)(/^\[[:^|]/), (0, combinator_1.syntax)(64 /* Syntax.placeholder */, 2, 1, 0 /* State.none */, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 2]]))), (0, source_1.str)(']'), false, ([, bs], rest) => [[(0, dom_1.html)('span', {
6277
6284
  class: 'invalid',
6278
6285
  'data-invalid-syntax': 'extension',
6279
6286
  'data-invalid-type': 'syntax',
@@ -6702,9 +6709,7 @@ const source_1 = __webpack_require__(6743);
6702
6709
  const visibility_1 = __webpack_require__(7618);
6703
6710
  const util_1 = __webpack_require__(9437);
6704
6711
  const dom_1 = __webpack_require__(3252);
6705
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(128 /* State.reference */, false, (0, combinator_1.syntax)(256 /* Syntax.reference */, 6, 1, 256 /* State.annotation */ | 128 /* State.reference */ | 8 /* State.media */, (0, visibility_1.startLoose)((0, combinator_1.context)({
6706
- delimiters: undefined
6707
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']'))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
6712
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(128 /* State.reference */, false, (0, combinator_1.syntax)(256 /* Syntax.reference */, 6, 1, 256 /* State.annotation */ | 128 /* State.reference */ | 8 /* State.media */, (0, visibility_1.startLoose)((0, combinator_1.subsequence)([abbr, (0, combinator_1.fmap)((0, source_1.str)('^'), ns => ['', ...ns]), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])]), ']'))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
6708
6713
  const abbr = (0, combinator_1.creation)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(visibility_1.regBlankStart, '')]));
6709
6714
  function attributes(ns) {
6710
6715
  return typeof ns[0] === 'object' && ns[0].tagName === 'ABBR' ? {
@@ -7583,7 +7588,7 @@ exports.stringify = stringify;
7583
7588
  Object.defineProperty(exports, "__esModule", ({
7584
7589
  value: true
7585
7590
  }));
7586
- exports.trimNode = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.blankWith = exports.regBlankStart = exports.visualize = void 0;
7591
+ exports.trimNodeEnd = exports.trimNode = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.blankWith = exports.regBlankStart = exports.visualize = void 0;
7587
7592
  const parser_1 = __webpack_require__(6728);
7588
7593
  const combinator_1 = __webpack_require__(2087);
7589
7594
  const htmlentity_1 = __webpack_require__(1562);
@@ -7719,11 +7724,9 @@ exports.trimBlank = trimBlank;
7719
7724
  function trimBlankStart(parser) {
7720
7725
  return (0, combinator_1.convert)((0, memoize_1.reduce)(source => source.replace(exports.regBlankStart, '')), parser);
7721
7726
  }
7722
- exports.trimBlankStart = trimBlankStart;
7723
7727
  function trimBlankEnd(parser) {
7724
7728
  return (0, combinator_1.fmap)(parser, trimNodeEnd);
7725
7729
  }
7726
- exports.trimBlankEnd = trimBlankEnd;
7727
7730
  function trimNode(nodes) {
7728
7731
  return trimNodeStart(trimNodeEnd(nodes));
7729
7732
  }
@@ -7756,6 +7759,7 @@ function trimNodeEnd(nodes) {
7756
7759
  }
7757
7760
  return (0, array_1.push)(nodes, skip);
7758
7761
  }
7762
+ exports.trimNodeEnd = trimNodeEnd;
7759
7763
 
7760
7764
  /***/ }),
7761
7765
 
@@ -8718,9 +8722,9 @@ exports.defrag = defrag;
8718
8722
  /******/ // startup
8719
8723
  /******/ // Load entry module and return exports
8720
8724
  /******/ // This entry module is referenced by other modules so it can't be inlined
8721
- /******/ var __webpack_exports__ = __nested_webpack_require_11449__(521);
8725
+ /******/ var __nested_webpack_exports__ = __nested_webpack_require_11449__(521);
8722
8726
  /******/
8723
- /******/ return __webpack_exports__;
8727
+ /******/ return __nested_webpack_exports__;
8724
8728
  /******/ })()
8725
8729
  ;
8726
8730
  });
@@ -8738,10 +8742,10 @@ exports.defrag = defrag;
8738
8742
  })(this, () => {
8739
8743
  return /******/ (() => { // webpackBootstrap
8740
8744
  /******/ "use strict";
8741
- var __webpack_exports__ = {};
8745
+ var __nested_webpack_exports__ = {};
8742
8746
  // This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
8743
8747
  (() => {
8744
- var exports = __webpack_exports__;
8748
+ var exports = __nested_webpack_exports__;
8745
8749
 
8746
8750
 
8747
8751
  Object.defineProperty(exports, "__esModule", ({
@@ -8773,7 +8777,7 @@ function querySelectorAll(node, selector) {
8773
8777
  exports.querySelectorAll = querySelectorAll;
8774
8778
  })();
8775
8779
 
8776
- /******/ return __webpack_exports__;
8780
+ /******/ return __nested_webpack_exports__;
8777
8781
  /******/ })()
8778
8782
  ;
8779
8783
  });
package/markdown.d.ts CHANGED
@@ -663,7 +663,7 @@ export namespace MarkdownParser {
663
663
  Inline<'reference'>,
664
664
  Parser<HTMLElement, Context, [
665
665
  ReferenceParser.AbbrParser,
666
- InlineParser,
666
+ SourceParser.StrParser,
667
667
  InlineParser,
668
668
  ]> {
669
669
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.269.1",
3
+ "version": "0.270.1",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",
@@ -1,5 +1,5 @@
1
1
  import { AnnotationParser } from '../inline';
2
- import { union, some, context, syntax, constraint, surround, lazy } from '../../combinator';
2
+ import { union, some, syntax, constraint, surround, lazy } from '../../combinator';
3
3
  import { inline } from '../inline';
4
4
  import { Syntax, State } from '../context';
5
5
  import { startLoose, trimNode } from '../visibility';
@@ -10,8 +10,7 @@ export const annotation: AnnotationParser = lazy(() => surround(
10
10
  constraint(State.annotation, false,
11
11
  syntax(Syntax.none, 6, 1, State.annotation | State.media,
12
12
  startLoose(
13
- context({ delimiters: undefined },
14
- some(union([inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))),
13
+ some(union([inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]]), ')'))),
15
14
  '))',
16
15
  false,
17
16
  ([, ns], rest) => [[html('sup', { class: 'annotation' }, [html('span', trimNode(defrag(ns)))])], rest]));
@@ -24,7 +24,7 @@ export const bracket: BracketParser = lazy(() => union([
24
24
  undefined,
25
25
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
26
26
  // Control media blinking in editing rather than control confusion of pairs of quote marks.
27
- surround(str('"'), syntax(Syntax.none, 8, 1, State.none, some(inline, '"', [['"', 8]])), str('"'), true,
27
+ surround(str('"'), syntax(Syntax.none, 3, 1, State.none, some(inline, '"', [['"', 3]])), str('"'), true,
28
28
  undefined,
29
29
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
30
30
  ]));
@@ -4,7 +4,7 @@ import { inline } from '../../inline';
4
4
  import { indexee, identity } from './indexee';
5
5
  import { txt, str, stropt } from '../../source';
6
6
  import { Syntax, State } from '../../context';
7
- import { startTight, trimBlankEnd } from '../../visibility';
7
+ import { startTight, trimNodeEnd } from '../../visibility';
8
8
  import { html, define, defrag } from 'typed-dom/dom';
9
9
 
10
10
  import IndexParser = ExtensionParser.IndexParser;
@@ -14,13 +14,13 @@ export const index: IndexParser = lazy(() => validate('[#', fmap(indexee(surroun
14
14
  constraint(State.index, false,
15
15
  syntax(Syntax.index, 2, 1, State.linkers | State.media,
16
16
  startTight(
17
- open(stropt('|'), trimBlankEnd(some(union([
17
+ open(stropt('|'), some(union([
18
18
  signature,
19
19
  inline,
20
- ]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))),
20
+ ]), ']', [[/^\\?\n/, 9], [']', 2]]), true)))),
21
21
  ']',
22
22
  false,
23
- ([, ns], rest) => [[html('a', defrag(ns))], rest])),
23
+ ([, ns], rest) => [[html('a', trimNodeEnd(defrag(ns)))], rest])),
24
24
  ([el]: [HTMLAnchorElement]) => [
25
25
  define(el,
26
26
  {
@@ -33,16 +33,16 @@ describe('Unit: parser/inline/extension/placeholder', () => {
33
33
  it('valid', () => {
34
34
  assert.deepStrictEqual(inspect(parser('[^a]')), [['<span class="invalid">a</span>'], '']);
35
35
  assert.deepStrictEqual(inspect(parser('[^a b]')), [['<span class="invalid">a b</span>'], '']);
36
- assert.deepStrictEqual(inspect(parser('[^a ]')), [['<span class="invalid">a</span>'], '']);
37
- assert.deepStrictEqual(inspect(parser('[^a ]')), [['<span class="invalid">a</span>'], '']);
38
- assert.deepStrictEqual(inspect(parser('[^a\\ ]')), [['<span class="invalid">a</span>'], '']);
39
- assert.deepStrictEqual(inspect(parser('[^a\\ \\ ]')), [['<span class="invalid">a</span>'], '']);
40
- assert.deepStrictEqual(inspect(parser('[^a\n]')), [['<span class="invalid">a</span>'], '']);
41
- assert.deepStrictEqual(inspect(parser('[^a\\\n]')), [['<span class="invalid">a</span>'], '']);
36
+ assert.deepStrictEqual(inspect(parser('[^a ]')), [['<span class="invalid">a </span>'], '']);
37
+ assert.deepStrictEqual(inspect(parser('[^a ]')), [['<span class="invalid">a </span>'], '']);
38
+ assert.deepStrictEqual(inspect(parser('[^a\\ ]')), [['<span class="invalid">a </span>'], '']);
39
+ assert.deepStrictEqual(inspect(parser('[^a\\ \\ ]')), [['<span class="invalid">a </span>'], '']);
40
+ assert.deepStrictEqual(inspect(parser('[^a\n]')), [['<span class="invalid">a<br></span>'], '']);
41
+ assert.deepStrictEqual(inspect(parser('[^a\\\n]')), [['<span class="invalid">a<br></span>'], '']);
42
42
  assert.deepStrictEqual(inspect(parser('[^a\nb]')), [['<span class="invalid">a<br>b</span>'], '']);
43
43
  assert.deepStrictEqual(inspect(parser('[^a\\\nb]')), [['<span class="invalid">a<br>b</span>'], '']);
44
- assert.deepStrictEqual(inspect(parser('[^a<wbr>]')), [['<span class="invalid">a</span>'], '']);
45
- assert.deepStrictEqual(inspect(parser('[^a<wbr><wbr>]')), [['<span class="invalid">a</span>'], '']);
44
+ assert.deepStrictEqual(inspect(parser('[^a<wbr>]')), [['<span class="invalid">a<wbr></span>'], '']);
45
+ assert.deepStrictEqual(inspect(parser('[^a<wbr><wbr>]')), [['<span class="invalid">a<wbr><wbr></span>'], '']);
46
46
  assert.deepStrictEqual(inspect(parser('[^==]')), [['<span class="invalid">==</span>'], '']);
47
47
  assert.deepStrictEqual(inspect(parser('[^a[% b %]]')), [['<span class="invalid">a<span class="comment"><input type="checkbox"><span>[% b %]</span></span></span>'], '']);
48
48
  assert.deepStrictEqual(inspect(parser('[^a[% b %][% c %]]')), [['<span class="invalid">a<span class="comment"><input type="checkbox"><span>[% b %]</span></span><span class="comment"><input type="checkbox"><span>[% c %]</span></span></span>'], '']);
@@ -3,7 +3,7 @@ import { union, some, syntax, validate, surround, lazy } from '../../../combinat
3
3
  import { inline } from '../../inline';
4
4
  import { str } from '../../source';
5
5
  import { Syntax, State } from '../../context';
6
- import { startTight, trimBlankEnd } from '../../visibility';
6
+ import { startTight } from '../../visibility';
7
7
  import { unshift } from 'spica/array';
8
8
  import { html, defrag } from 'typed-dom/dom';
9
9
 
@@ -14,7 +14,7 @@ import { html, defrag } from 'typed-dom/dom';
14
14
  export const placeholder: ExtensionParser.PlaceholderParser = lazy(() => validate('[', surround(
15
15
  str(/^\[[:^|]/),
16
16
  syntax(Syntax.placeholder, 2, 1, State.none,
17
- startTight(trimBlankEnd(some(union([inline]), ']', [[']', 2]])))),
17
+ startTight(some(union([inline]), ']', [[']', 2]]))),
18
18
  str(']'), false,
19
19
  ([, bs], rest) => [[
20
20
  html('span', {
@@ -1,7 +1,7 @@
1
1
  import { ReferenceParser } from '../inline';
2
- import { union, subsequence, some, context, syntax, creation, constraint, surround, open, lazy, bind } from '../../combinator';
2
+ import { union, subsequence, some, syntax, creation, constraint, surround, lazy, fmap, bind } from '../../combinator';
3
3
  import { inline } from '../inline';
4
- import { str, stropt } from '../source';
4
+ import { str } from '../source';
5
5
  import { Syntax, State } from '../context';
6
6
  import { regBlankStart, startLoose, trimNode } from '../visibility';
7
7
  import { stringify } from '../util';
@@ -12,12 +12,11 @@ export const reference: ReferenceParser = lazy(() => surround(
12
12
  constraint(State.reference, false,
13
13
  syntax(Syntax.reference, 6, 1, State.annotation | State.reference | State.media,
14
14
  startLoose(
15
- context({ delimiters: undefined },
16
15
  subsequence([
17
16
  abbr,
18
- open(stropt(/^(?=\^)/), some(inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])),
17
+ fmap(str('^'), ns => ['', ...ns]),
19
18
  some(inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]]),
20
- ])), ']'))),
19
+ ]), ']'))),
21
20
  ']]',
22
21
  false,
23
22
  ([, ns], rest) => [[html('sup', attributes(ns), [html('span', trimNode(defrag(ns)))])], rest]));
@@ -97,7 +97,7 @@ describe('Unit: parser/inline', () => {
97
97
  assert.deepStrictEqual(inspect(parser('[++[a\nb++]')), [['', '[', '++', '[', 'a', '<br>', 'b', '++', ']'], '']);
98
98
  assert.deepStrictEqual(inspect(parser('[[++a\nb++]]')), [['[', '[', '<ins>a<br>b</ins>', ']', ']'], '']);
99
99
  assert.deepStrictEqual(inspect(parser('"[% *"*"*')), [['"', '[%', ' ', '*', '"', '*', '"', '*'], '']);
100
- assert.deepStrictEqual(inspect(parser('"[% "*"* %]')), [['"', '[%', ' ', '"', '*', '"', '*', ' ', '%', ']'], '']);
100
+ assert.deepStrictEqual(inspect(parser('"[% "*"* %]')), [['"', '<span class="comment"><input type="checkbox"><span>[% "*"* %]</span></span>'], '']);
101
101
  });
102
102
 
103
103
  it('uri', () => {
@@ -150,14 +150,14 @@ export function trimBlank<P extends Parser<HTMLElement | string>>(parser: P): P;
150
150
  export function trimBlank<T extends HTMLElement | string>(parser: Parser<T>): Parser<T> {
151
151
  return trimBlankStart(trimBlankEnd(parser));
152
152
  }
153
- export function trimBlankStart<P extends Parser<unknown>>(parser: P): P;
154
- export function trimBlankStart<T>(parser: Parser<T>): Parser<T> {
153
+ function trimBlankStart<P extends Parser<unknown>>(parser: P): P;
154
+ function trimBlankStart<T>(parser: Parser<T>): Parser<T> {
155
155
  return convert(
156
156
  reduce(source => source.replace(regBlankStart, '')),
157
157
  parser);
158
158
  }
159
- export function trimBlankEnd<P extends Parser<HTMLElement | string>>(parser: P): P;
160
- export function trimBlankEnd<T extends HTMLElement | string>(parser: Parser<T>): Parser<T> {
159
+ function trimBlankEnd<P extends Parser<HTMLElement | string>>(parser: P): P;
160
+ function trimBlankEnd<T extends HTMLElement | string>(parser: Parser<T>): Parser<T> {
161
161
  return fmap(
162
162
  parser,
163
163
  trimNodeEnd);
@@ -179,7 +179,7 @@ function trimNodeStart<T extends HTMLElement | string>(nodes: T[]): T[] {
179
179
  }
180
180
  return nodes;
181
181
  }
182
- function trimNodeEnd<T extends HTMLElement | string>(nodes: T[]): T[] {
182
+ export function trimNodeEnd<T extends HTMLElement | string>(nodes: T[]): T[] {
183
183
  const skip = nodes.length > 0 &&
184
184
  typeof nodes[nodes.length - 1] === 'object' &&
185
185
  nodes[nodes.length - 1]['className'] === 'indexer'
package/webpack.config.js CHANGED
@@ -81,7 +81,7 @@ module.exports = env => {
81
81
  return merge(config);
82
82
  case 'lint':
83
83
  return merge(config, {
84
- entry: glob.sync('./!(node_modules)**/*.ts'),
84
+ entry: glob.sync('./!(node_modules)/**/*.ts'),
85
85
  plugins: [
86
86
  new ESLintPlugin({
87
87
  extensions: ['ts'],