securemark 0.228.0 → 0.229.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.229.0
4
+
5
+ - Change table syntax's alignment syntax to remove cell type declaration.
6
+ - Change table syntax's dataline syntax.
7
+
3
8
  ## 0.228.0
4
9
 
5
10
  - Change table syntax to require horizontal alignment in alignment syntax.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.228.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.229.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) {
@@ -5257,23 +5257,22 @@ require = function () {
5257
5257
  (0, combinator_1.some)((0, combinator_1.union)([
5258
5258
  head,
5259
5259
  data,
5260
- source_1.emptyline,
5261
- (0, combinator_1.some)(dataline, alignment)
5260
+ (0, combinator_1.some)(dataline, alignment),
5261
+ source_1.emptyline
5262
5262
  ]))
5263
5263
  ]), ns => !(0, alias_1.isArray)(ns[0]) ? (0, array_1.unshift)([[[]]], ns) : ns)));
5264
- const alignment = /^[#:]?[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
5264
+ const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
5265
5265
  const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([s]) => s.split('/').map(s => s.split(''))));
5266
- const delimiter = /^[#:]?[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/;
5267
- const head = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
5266
+ const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/;
5267
+ const head = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
5268
5268
  source_1.anyline,
5269
5269
  (0, combinator_1.some)(source_1.contentline, delimiter)
5270
5270
  ]), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, typed_dom_1.html)('th', attributes(ns.shift()), (0, typed_dom_1.defrag)(ns))]), false));
5271
- const data = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
5271
+ const data = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
5272
5272
  source_1.anyline,
5273
5273
  (0, combinator_1.some)(source_1.contentline, delimiter)
5274
5274
  ]), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, typed_dom_1.html)('td', attributes(ns.shift()), (0, typed_dom_1.defrag)(ns))]), false));
5275
5275
  const dataline = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([
5276
- (0, combinator_1.validate)(/^:!*[^\S\n]/, data),
5277
5276
  (0, combinator_1.validate)(/^!+[^\S\n]/, (0, combinator_1.convert)(source => `:${ source }`, data)),
5278
5277
  (0, combinator_1.convert)(source => `: ${ source }`, data)
5279
5278
  ]))));
@@ -5310,10 +5309,7 @@ require = function () {
5310
5309
  ROW:
5311
5310
  for (let i = 0; i < rows.length; ++i) {
5312
5311
  const [[[...as], [...vs] = []], ...cells] = rows[i];
5313
- let isBody = target === tfoot ? false : [
5314
- as[0] === '#' ? !as.shift() : global_1.undefined,
5315
- as[0] === ':' ? !!as.shift() : global_1.undefined
5316
- ].reduce((a, b) => a !== null && a !== void 0 ? a : b);
5312
+ let isBody = target === tfoot ? false : global_1.undefined;
5317
5313
  as.length === 0 && as.push('-');
5318
5314
  ALIGN_H:
5319
5315
  for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {
package/markdown.d.ts CHANGED
@@ -455,8 +455,8 @@ export namespace MarkdownParser {
455
455
  Parser<HTMLTableCellElement, Context, [
456
456
  CellParser.HeadParser,
457
457
  CellParser.DataParser,
458
- SourceParser.EmptyLineParser,
459
458
  CellParser.DatalineParser,
459
+ SourceParser.EmptyLineParser,
460
460
  ]>,
461
461
  ]> {
462
462
  }
@@ -484,7 +484,6 @@ export namespace MarkdownParser {
484
484
  Parser<HTMLTableCellElement, Context, [
485
485
  DataParser,
486
486
  DataParser,
487
- DataParser,
488
487
  ]> {
489
488
  }
490
489
  }
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.228.0",
3
+ "version": "0.229.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -168,9 +168,9 @@
168
168
  }
169
169
  },
170
170
  "@babel/helper-module-transforms": {
171
- "version": "7.16.7",
172
- "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz",
173
- "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==",
171
+ "version": "7.17.6",
172
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.6.tgz",
173
+ "integrity": "sha512-2ULmRdqoOMpdvkbT8jONrZML/XALfzxlb052bldftkicAUy8AxSCkD5trDPQcwHNmolcl7wP6ehNqMlyUw6AaA==",
174
174
  "dev": true,
175
175
  "requires": {
176
176
  "@babel/helper-environment-visitor": "^7.16.7",
@@ -179,8 +179,8 @@
179
179
  "@babel/helper-split-export-declaration": "^7.16.7",
180
180
  "@babel/helper-validator-identifier": "^7.16.7",
181
181
  "@babel/template": "^7.16.7",
182
- "@babel/traverse": "^7.16.7",
183
- "@babel/types": "^7.16.7"
182
+ "@babel/traverse": "^7.17.3",
183
+ "@babel/types": "^7.17.0"
184
184
  }
185
185
  },
186
186
  "@babel/helper-simple-access": {
@@ -437,9 +437,9 @@
437
437
  },
438
438
  "dependencies": {
439
439
  "lru-cache": {
440
- "version": "7.3.1",
441
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.3.1.tgz",
442
- "integrity": "sha512-nX1x4qUrKqwbIAhv4s9et4FIUVzNOpeY07bsjGUy8gwJrXH/wScImSQqXErmo/b2jZY2r0mohbLA9zVj7u1cNw==",
440
+ "version": "7.4.0",
441
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.0.tgz",
442
+ "integrity": "sha512-YOfuyWa/Ee+PXbDm40j9WXyJrzQUynVbgn4Km643UYcWNcrSfRkKL0WaiUcxcIbkXcVTgNpDqSnPXntWXT75cw==",
443
443
  "dev": true
444
444
  },
445
445
  "mkdirp": {
@@ -606,9 +606,9 @@
606
606
  "dev": true
607
607
  },
608
608
  "@types/node": {
609
- "version": "17.0.18",
610
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.18.tgz",
611
- "integrity": "sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA==",
609
+ "version": "17.0.19",
610
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.19.tgz",
611
+ "integrity": "sha512-PfeQhvcMR4cPFVuYfBN4ifG7p9c+Dlh3yUZR6k+5yQK7wX3gDgVxBly4/WkBRs9x4dmcy1TVl08SY67wwtEvmA==",
612
612
  "dev": true
613
613
  },
614
614
  "@types/power-assert": {
@@ -752,9 +752,9 @@
752
752
  }
753
753
  },
754
754
  "agentkeepalive": {
755
- "version": "4.2.0",
756
- "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.0.tgz",
757
- "integrity": "sha512-0PhAp58jZNw13UJv7NVdTGb0ZcghHUb3DrZ046JiiJY/BOaTTpbwdHq2VObPCBV8M2GPh7sgrJ3AQ8Ey468LJw==",
755
+ "version": "4.2.1",
756
+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz",
757
+ "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==",
758
758
  "dev": true,
759
759
  "requires": {
760
760
  "debug": "^4.1.0",
@@ -7656,9 +7656,9 @@
7656
7656
  }
7657
7657
  },
7658
7658
  "lru-cache": {
7659
- "version": "7.3.1",
7660
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.3.1.tgz",
7661
- "integrity": "sha512-nX1x4qUrKqwbIAhv4s9et4FIUVzNOpeY07bsjGUy8gwJrXH/wScImSQqXErmo/b2jZY2r0mohbLA9zVj7u1cNw==",
7659
+ "version": "7.4.0",
7660
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.0.tgz",
7661
+ "integrity": "sha512-YOfuyWa/Ee+PXbDm40j9WXyJrzQUynVbgn4Km643UYcWNcrSfRkKL0WaiUcxcIbkXcVTgNpDqSnPXntWXT75cw==",
7662
7662
  "dev": true
7663
7663
  },
7664
7664
  "make-fetch-happen": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.228.0",
3
+ "version": "0.229.0",
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",
@@ -108,7 +108,7 @@ describe('Unit: parser/block/extension/table', () => {
108
108
  [[html('table', [
109
109
  html('thead'),
110
110
  html('tbody', [
111
- html('tr', [html('td', '1.1'), html('td', '1.2'), html('td', ':1:1 1.3'), html('td', '1.4')]),
111
+ html('tr', [html('td', '1.1'), html('td', ': 1.2'), html('td', ':1:1 1.3'), html('td', '1.4')]),
112
112
  ]),
113
113
  html('tfoot'),
114
114
  ]).outerHTML], '']);
@@ -238,18 +238,18 @@ describe('Unit: parser/block/extension/table', () => {
238
238
 
239
239
  it('head', () => {
240
240
  assert.deepStrictEqual(
241
- inspect(parser('~~~table\n#-\n1.1\n~~~')),
241
+ inspect(parser('~~~table\n-\n# 1.1\n~~~')),
242
242
  [[html('table', [
243
243
  html('thead', [
244
- html('tr', [html('td', '1.1')]),
244
+ html('tr', [html('th', '1.1')]),
245
245
  ]),
246
246
  html('tbody'),
247
247
  html('tfoot')]).outerHTML], '']);
248
248
  assert.deepStrictEqual(
249
- inspect(parser('~~~table\n#-/-\n1.1\n~~~')),
249
+ inspect(parser('~~~table\n-/-\n# 1.1\n~~~')),
250
250
  [[html('table', [
251
251
  html('thead', [
252
- html('tr', [html('td', '1.1')]),
252
+ html('tr', [html('th', '1.1')]),
253
253
  ]),
254
254
  html('tbody'),
255
255
  html('tfoot')]).outerHTML], '']);
@@ -269,14 +269,6 @@ describe('Unit: parser/block/extension/table', () => {
269
269
  html('tr', [html('th', '1.1'), html('td', '1.2')]),
270
270
  ]),
271
271
  html('tfoot')]).outerHTML], '']);
272
- assert.deepStrictEqual(
273
- inspect(parser('~~~table\n:-\n# 1.1\n~~~')),
274
- [[html('table', [
275
- html('thead'),
276
- html('tbody', [
277
- html('tr', [html('th', '1.1')]),
278
- ]),
279
- html('tfoot')]).outerHTML], '']);
280
272
  });
281
273
 
282
274
  it('foot', () => {
@@ -408,11 +400,11 @@ describe('Unit: parser/block/extension/table', () => {
408
400
  html('tfoot'),
409
401
  ]).outerHTML], '']);
410
402
  assert.deepStrictEqual(
411
- inspect(parser('~~~table\n#-\n: \n#! 1.2\n-\n#! 2.1\n: 2.2\n~~~')),
403
+ inspect(parser('~~~table\n-\n# \n#! 1.2\n-\n#! 2.1\n: 2.2\n~~~')),
412
404
  [[html('table', [
413
405
  html('thead', [
414
406
  html('tr', [
415
- html('td'),
407
+ html('th'),
416
408
  html('th', { class: 'highlight' }, '1.2'),
417
409
  ]),
418
410
  ]),
@@ -425,11 +417,11 @@ describe('Unit: parser/block/extension/table', () => {
425
417
  html('tfoot'),
426
418
  ]).outerHTML], '']);
427
419
  assert.deepStrictEqual(
428
- inspect(parser('~~~table\n#-\n: \n#! 1.2\n-\n#! 2.1\n:! 2.2\n~~~')),
420
+ inspect(parser('~~~table\n-\n# \n#! 1.2\n-\n#! 2.1\n:! 2.2\n~~~')),
429
421
  [[html('table', [
430
422
  html('thead', [
431
423
  html('tr', [
432
- html('td'),
424
+ html('th'),
433
425
  html('th', { class: 'highlight' }, '1.2'),
434
426
  ]),
435
427
  ]),
@@ -61,22 +61,22 @@ const row: RowParser = lazy(() => dup(fmap(
61
61
  some(union([
62
62
  head,
63
63
  data,
64
- emptyline,
65
64
  some(dataline, alignment),
65
+ emptyline,
66
66
  ])),
67
67
  ]),
68
68
  ns => !isArray(ns[0]) ? unshift([[[]]], ns) : ns)));
69
69
 
70
- const alignment = /^[#:]?[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
70
+ const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
71
71
 
72
72
  const align: AlignParser = line(fmap(
73
73
  union([str(alignment)]),
74
74
  ([s]) => s.split('/').map(s => s.split(''))));
75
75
 
76
- const delimiter = /^[#:]?[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/;
76
+ const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/;
77
77
 
78
78
  const head: CellParser.HeadParser = creator(block(fmap(open(
79
- str(/^#(?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/),
79
+ str(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/),
80
80
  rewrite(
81
81
  inits([
82
82
  anyline,
@@ -88,7 +88,7 @@ const head: CellParser.HeadParser = creator(block(fmap(open(
88
88
  false));
89
89
 
90
90
  const data: CellParser.DataParser = creator(block(fmap(open(
91
- str(/^:(?:(?!:!*[^\S\n]|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/),
91
+ str(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/),
92
92
  rewrite(
93
93
  inits([
94
94
  anyline,
@@ -103,7 +103,6 @@ const dataline: CellParser.DatalineParser = creator(line(
103
103
  rewrite(
104
104
  contentline,
105
105
  union([
106
- validate(/^:!*[^\S\n]/, data),
107
106
  validate(/^!+[^\S\n]/, convert(source => `:${source}`, data)),
108
107
  convert(source => `: ${source}`, data),
109
108
  ]))));
@@ -152,10 +151,7 @@ function format(rows: Tree<RowParser>[]): HTMLTableSectionElement[] {
152
151
  assert(cells !== rows[i]);
153
152
  let isBody = target === tfoot
154
153
  ? false
155
- : [
156
- as[0] === '#' ? !as.shift() : undefined,
157
- as[0] === ':' ? !!as.shift() : undefined,
158
- ].reduce((a, b) => a ?? b);
154
+ : undefined;
159
155
  as.length === 0 && as.push('-');
160
156
  ALIGN_H:
161
157
  for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {