securemark 0.276.4 → 0.276.5
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 +9 -10
- package/package.json +3 -3
- package/src/parser/processor/note.ts +7 -9
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.276.
|
|
1
|
+
/*! securemark v0.276.5 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"));
|
|
@@ -2219,7 +2219,7 @@ function xorshift(seed = xorshift.seed()) {
|
|
|
2219
2219
|
let x = seed;
|
|
2220
2220
|
x ^= x << 13;
|
|
2221
2221
|
x ^= x >> 17;
|
|
2222
|
-
x ^= x <<
|
|
2222
|
+
x ^= x << 15;
|
|
2223
2223
|
return seed = x >>> 0;
|
|
2224
2224
|
};
|
|
2225
2225
|
}
|
|
@@ -7140,8 +7140,8 @@ function* note(target, notes, opts = {}, bottom = null) {
|
|
|
7140
7140
|
exports.note = note;
|
|
7141
7141
|
exports.annotation = build('annotation', n => `*${n}`, 'h1, h2, h3, h4, h5, h6, aside.aside, hr');
|
|
7142
7142
|
exports.reference = build('reference', (n, abbr) => `[${abbr || n}]`);
|
|
7143
|
-
function build(syntax, marker, splitter) {
|
|
7144
|
-
splitter
|
|
7143
|
+
function build(syntax, marker, splitter = '') {
|
|
7144
|
+
splitter &&= `${splitter}, .${syntax}s`;
|
|
7145
7145
|
// Referenceを含むAnnotationの重複排除は両構文が互いに処理済みであることを必要とするため
|
|
7146
7146
|
// 構文ごとに各1回の処理では不可能
|
|
7147
7147
|
const memory = (0, memoize_1.memoize)(ref => {
|
|
@@ -7163,8 +7163,7 @@ function build(syntax, marker, splitter) {
|
|
|
7163
7163
|
const defIndexes = new Map();
|
|
7164
7164
|
const refSubindexes = new Map();
|
|
7165
7165
|
const defSubindexes = new Map();
|
|
7166
|
-
const
|
|
7167
|
-
const splitters = split ? target.querySelectorAll(splitter) : [];
|
|
7166
|
+
const splitters = splitter ? target.querySelectorAll(splitter) : [];
|
|
7168
7167
|
let iSplitters = 0;
|
|
7169
7168
|
let total = 0;
|
|
7170
7169
|
let format;
|
|
@@ -7175,7 +7174,7 @@ function build(syntax, marker, splitter) {
|
|
|
7175
7174
|
yield;
|
|
7176
7175
|
continue;
|
|
7177
7176
|
}
|
|
7178
|
-
if (
|
|
7177
|
+
if (splitter) for (let el; el = splitters[iSplitters], el?.compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING; ++iSplitters) {
|
|
7179
7178
|
if (~iSplitters << 32 - 8 === 0) yield;
|
|
7180
7179
|
if (el.parentNode !== target) continue;
|
|
7181
7180
|
if (el.tagName === 'OL' && el.nextElementSibling !== splitters[iSplitters + 1]) {
|
|
@@ -7199,10 +7198,10 @@ function build(syntax, marker, splitter) {
|
|
|
7199
7198
|
const refSubindex = refSubindexes.get(identifier) + 1 || 1;
|
|
7200
7199
|
refSubindexes.set(identifier, refSubindex);
|
|
7201
7200
|
const refId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:ref:${identifier}:${refSubindex}` : undefined;
|
|
7202
|
-
const initial =
|
|
7201
|
+
const initial = splitter ? !defs.has(identifier) : refSubindex === 1;
|
|
7203
7202
|
const defSubindex = defSubindexes?.get(identifier) + +initial || 1;
|
|
7204
7203
|
initial && defSubindexes?.set(identifier, defSubindex);
|
|
7205
|
-
const defId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${identifier}${
|
|
7204
|
+
const defId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${identifier}${splitter && `:${defSubindex}`}` : undefined;
|
|
7206
7205
|
const def = initial ? (0, dom_1.html)('li', {
|
|
7207
7206
|
id: defId,
|
|
7208
7207
|
'data-marker': note ? undefined : marker(total + defs.size + 1, abbr)
|
|
@@ -7247,7 +7246,7 @@ function build(syntax, marker, splitter) {
|
|
|
7247
7246
|
}), splitters[iSplitters] ?? bottom);
|
|
7248
7247
|
yield* proc(defs, note);
|
|
7249
7248
|
}
|
|
7250
|
-
if (
|
|
7249
|
+
if (splitter) for (let el; el = splitters[iSplitters]; ++iSplitters) {
|
|
7251
7250
|
if (~iSplitters << 32 - 8 === 0) yield;
|
|
7252
7251
|
if (el.parentNode !== target) continue;
|
|
7253
7252
|
if (el.tagName === 'OL') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.276.
|
|
3
|
+
"version": "0.276.5",
|
|
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",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"mocha": "^10.2.0",
|
|
52
52
|
"npm-check-updates": "^16.10.12",
|
|
53
53
|
"semver": "^7.5.1",
|
|
54
|
-
"spica": "0.0.
|
|
54
|
+
"spica": "0.0.731",
|
|
55
55
|
"ts-loader": "^9.4.3",
|
|
56
56
|
"typed-dom": "0.0.335",
|
|
57
57
|
"typescript": "5.1.3",
|
|
58
58
|
"webpack": "^5.85.0",
|
|
59
|
-
"webpack-cli": "^5.1.
|
|
59
|
+
"webpack-cli": "^5.1.3",
|
|
60
60
|
"webpack-merge": "^5.9.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
@@ -23,10 +23,10 @@ export const reference = build('reference', (n, abbr) => `[${abbr || n}]`);
|
|
|
23
23
|
function build(
|
|
24
24
|
syntax: 'annotation' | 'reference',
|
|
25
25
|
marker: (index: number, abbr: string) => string,
|
|
26
|
-
splitter
|
|
26
|
+
splitter: string = '',
|
|
27
27
|
) {
|
|
28
28
|
assert(syntax.match(/^[a-z]+$/));
|
|
29
|
-
splitter
|
|
29
|
+
splitter &&= `${splitter}, .${syntax}s`;
|
|
30
30
|
// Referenceを含むAnnotationの重複排除は両構文が互いに処理済みであることを必要とするため
|
|
31
31
|
// 構文ごとに各1回の処理では不可能
|
|
32
32
|
const memory = memoize((ref: HTMLElement): {
|
|
@@ -61,15 +61,13 @@ function build(
|
|
|
61
61
|
opts: { readonly id?: string } = {},
|
|
62
62
|
bottom: Node | null = null,
|
|
63
63
|
): Generator<HTMLAnchorElement | HTMLLIElement | undefined, undefined, undefined> {
|
|
64
|
-
assert(splitter = splitter!);
|
|
65
64
|
const defs = new Map<string, HTMLLIElement>();
|
|
66
65
|
const refs = target.querySelectorAll(`sup.${syntax}:not(.disabled)`);
|
|
67
66
|
const titles = new Map<string, string>();
|
|
68
67
|
const defIndexes = new Map<HTMLLIElement, number>();
|
|
69
68
|
const refSubindexes = new Map<string, number>();
|
|
70
69
|
const defSubindexes = new Map<string, number>();
|
|
71
|
-
const
|
|
72
|
-
const splitters = split ? target.querySelectorAll(splitter) : [];
|
|
70
|
+
const splitters = splitter ? target.querySelectorAll(splitter) : [];
|
|
73
71
|
let iSplitters = 0;
|
|
74
72
|
let total = 0;
|
|
75
73
|
let format: 'number' | 'abbr';
|
|
@@ -80,7 +78,7 @@ function build(
|
|
|
80
78
|
yield;
|
|
81
79
|
continue;
|
|
82
80
|
}
|
|
83
|
-
if (
|
|
81
|
+
if (splitter) for (
|
|
84
82
|
let el: Element;
|
|
85
83
|
el = splitters[iSplitters],
|
|
86
84
|
el?.compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING;
|
|
@@ -108,13 +106,13 @@ function build(
|
|
|
108
106
|
const refId = opts.id !== ''
|
|
109
107
|
? `${syntax}:${opts.id ?? ''}:ref:${identifier}:${refSubindex}`
|
|
110
108
|
: undefined;
|
|
111
|
-
const initial =
|
|
109
|
+
const initial = splitter
|
|
112
110
|
? !defs.has(identifier)
|
|
113
111
|
: refSubindex === 1;
|
|
114
112
|
const defSubindex = defSubindexes?.get(identifier)! + +initial || 1;
|
|
115
113
|
initial && defSubindexes?.set(identifier, defSubindex);
|
|
116
114
|
const defId = opts.id !== ''
|
|
117
|
-
? `${syntax}:${opts.id ?? ''}:def:${identifier}${
|
|
115
|
+
? `${syntax}:${opts.id ?? ''}:def:${identifier}${splitter && `:${defSubindex}`}`
|
|
118
116
|
: undefined;
|
|
119
117
|
const def = initial
|
|
120
118
|
? html('li',
|
|
@@ -170,7 +168,7 @@ function build(
|
|
|
170
168
|
: target.insertBefore(html('ol', { class: `${syntax}s` }), splitters[iSplitters] ?? bottom);
|
|
171
169
|
yield* proc(defs, note);
|
|
172
170
|
}
|
|
173
|
-
if (
|
|
171
|
+
if (splitter) for (
|
|
174
172
|
let el: Element;
|
|
175
173
|
el = splitters[iSplitters];
|
|
176
174
|
++iSplitters) {
|