securemark 0.281.3 → 0.281.4

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.281.4
4
+
5
+ - Fix identifiers.
6
+
3
7
  ## 0.281.3
4
8
 
5
9
  - Refactoring.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.281.3 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.281.4 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"));
@@ -6120,7 +6120,7 @@ function identity(type, id, text) {
6120
6120
  const str = text.replace(/\s/g, '_');
6121
6121
  const cs = [...str];
6122
6122
  if (type === '' || cs.length <= MAX) {
6123
- return `${type}:${id ?? ''}:${str}${/_|[^\S ]/.test(text) ? `=${hash(text)}` : ''}`;
6123
+ return `${type}:${id ?? ''}:${str}${/_|[^\S ]|=[0-9a-z]{1,7}$/.test(text) ? `=${hash(text)}` : ''}`;
6124
6124
  }
6125
6125
  const s1 = cs.slice(0, PART + REM).join('');
6126
6126
  const s2 = cs.slice(-PART).join('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.281.3",
3
+ "version": "0.281.4",
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",
@@ -32,7 +32,7 @@ export function identity(
32
32
  const str = text.replace(/\s/g, '_');
33
33
  const cs = [...str];
34
34
  if (type === '' || cs.length <= MAX) {
35
- return `${type}:${id ?? ''}:${str}${/_|[^\S ]/.test(text) ? `=${hash(text)}` : ''}`;
35
+ return `${type}:${id ?? ''}:${str}${/_|[^\S ]|=[0-9a-z]{1,7}$/.test(text) ? `=${hash(text)}` : ''}`;
36
36
  }
37
37
  const s1 = cs.slice(0, PART + REM).join('');
38
38
  const s2 = cs.slice(-PART).join('');
@@ -48,6 +48,9 @@ assert.notDeepStrictEqual(
48
48
  assert.notDeepStrictEqual(
49
49
  identity('index', undefined, '0 0'),
50
50
  identity('index', undefined, '0\t0'));
51
+ assert.notDeepStrictEqual(
52
+ identity('index', undefined, '0_0'),
53
+ identity('index', undefined, identity('index', undefined, '0_0')!.slice(7).replace('_', ' ')));
51
54
  assert.deepStrictEqual(
52
55
  identity('index', undefined, `${'0'.repeat(MAX - 1)}1`)!.slice(7),
53
56
  `${'0'.repeat(MAX - 1)}1`);
@@ -30,7 +30,7 @@ describe('Unit: parser/inline/mark', () => {
30
30
 
31
31
  it('basic', () => {
32
32
  assert.deepStrictEqual(inspect(parser('==a==')), [['<mark id="mark::a">a</mark>', '<a href="#mark::a"></a>'], '']);
33
- assert.deepStrictEqual(inspect(parser('==a=b==')), [['<mark id="mark::a=b">a=b</mark>', '<a href="#mark::a=b"></a>'], '']);
33
+ assert.deepStrictEqual(inspect(parser('==a=b==')), [['<mark id="mark::a=b=1aef5x1">a=b</mark>', '<a href="#mark::a=b=1aef5x1"></a>'], '']);
34
34
  assert.deepStrictEqual(inspect(parser('==\\===')), [['<mark id="mark::=">=</mark>', '<a href="#mark::="></a>'], '']);
35
35
  assert.deepStrictEqual(inspect(parser('==a===')), [['<mark id="mark::a">a</mark>', '<a href="#mark::a"></a>'], '=']);
36
36
  });