update deps: marked.js, codemirror

This commit is contained in:
ed 2022-12-02 21:39:04 +00:00
parent 008d9b1834
commit 4242422898
3 changed files with 59 additions and 77 deletions

View file

@ -1,10 +1,11 @@
FROM alpine:3 # TODO easymde embeds codemirror on 3.17 due to new npm probably
FROM alpine:3.16
WORKDIR /z WORKDIR /z
ENV ver_asmcrypto=c72492f4a66e17a0e5dd8ad7874de354f3ccdaa5 \ ENV ver_asmcrypto=c72492f4a66e17a0e5dd8ad7874de354f3ccdaa5 \
ver_hashwasm=4.9.0 \ ver_hashwasm=4.9.0 \
ver_marked=4.0.18 \ ver_marked=4.2.3 \
ver_mde=2.18.0 \ ver_mde=2.18.0 \
ver_codemirror=5.65.9 \ ver_codemirror=5.65.10 \
ver_fontawesome=5.13.0 \ ver_fontawesome=5.13.0 \
ver_zopfli=1.0.3 ver_zopfli=1.0.3

View file

@ -1,5 +1,5 @@
diff --git a/src/Lexer.js b/src/Lexer.js diff --git a/src/Lexer.js b/src/Lexer.js
adds linetracking to marked.js v4.0.17; adds linetracking to marked.js v4.2.3;
add data-ln="%d" to most tags, %d is the source markdown line add data-ln="%d" to most tags, %d is the source markdown line
--- a/src/Lexer.js --- a/src/Lexer.js
+++ b/src/Lexer.js +++ b/src/Lexer.js
@ -123,20 +123,20 @@ add data-ln="%d" to most tags, %d is the source markdown line
+ this.ln++; + this.ln++;
lastToken = tokens[tokens.length - 1]; lastToken = tokens[tokens.length - 1];
if (lastToken && lastToken.type === 'text') { if (lastToken && lastToken.type === 'text') {
@@ -365,4 +396,5 @@ export class Lexer { @@ -367,4 +398,5 @@ export class Lexer {
if (token = extTokenizer.call({ lexer: this }, src, tokens)) { if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
src = src.substring(token.raw.length); src = src.substring(token.raw.length);
+ this.ln = token.ln || this.ln; + this.ln = token.ln || this.ln;
tokens.push(token); tokens.push(token);
return true; return true;
@@ -430,4 +462,6 @@ export class Lexer { @@ -432,4 +464,6 @@ export class Lexer {
if (token = this.tokenizer.br(src)) { if (token = this.tokenizer.br(src)) {
src = src.substring(token.raw.length); src = src.substring(token.raw.length);
+ // no need to reset (no more blockTokens anyways) + // no need to reset (no more blockTokens anyways)
+ token.ln = this.ln++; + token.ln = this.ln++;
tokens.push(token); tokens.push(token);
continue; continue;
@@ -472,4 +506,5 @@ export class Lexer { @@ -474,4 +508,5 @@ export class Lexer {
if (token = this.tokenizer.inlineText(cutSrc, smartypants)) { if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
src = src.substring(token.raw.length); src = src.substring(token.raw.length);
+ this.ln = token.ln || this.ln; + this.ln = token.ln || this.ln;
@ -234,7 +234,7 @@ index 7c36a75..aa1a53a 100644
- return '<pre><code class="' - return '<pre><code class="'
+ return '<pre' + this.ln + '><code class="' + return '<pre' + this.ln + '><code class="'
+ this.options.langPrefix + this.options.langPrefix
+ escape(lang, true) + escape(lang)
@@ -43,5 +49,5 @@ export class Renderer { @@ -43,5 +49,5 @@ export class Renderer {
*/ */
blockquote(quote) { blockquote(quote) {
@ -293,7 +293,7 @@ diff --git a/src/Tokenizer.js b/src/Tokenizer.js
index e8a69b6..2cc772b 100644 index e8a69b6..2cc772b 100644
--- a/src/Tokenizer.js --- a/src/Tokenizer.js
+++ b/src/Tokenizer.js +++ b/src/Tokenizer.js
@@ -302,4 +302,7 @@ export class Tokenizer { @@ -312,4 +312,7 @@ export class Tokenizer {
const l = list.items.length; const l = list.items.length;
+ // each nested list gets +1 ahead; this hack makes every listgroup -1 but atleast it doesn't get infinitely bad + // each nested list gets +1 ahead; this hack makes every listgroup -1 but atleast it doesn't get infinitely bad

View file

@ -1,35 +1,35 @@
diff --git a/src/Lexer.js b/src/Lexer.js diff --git a/src/Lexer.js b/src/Lexer.js
--- a/src/Lexer.js --- a/src/Lexer.js
+++ b/src/Lexer.js +++ b/src/Lexer.js
@@ -6,5 +6,5 @@ import { repeatString } from './helpers.js'; @@ -7,5 +7,5 @@ import { repeatString } from './helpers.js';
/**
* smartypants text replacement * smartypants text replacement
* @param {string} text
- */ - */
+ * + *
function smartypants(text) { function smartypants(text) {
return text return text
@@ -27,5 +27,5 @@ function smartypants(text) { @@ -29,5 +29,5 @@ function smartypants(text) {
/**
* mangle email addresses * mangle email addresses
* @param {string} text
- */ - */
+ * + *
function mangle(text) { function mangle(text) {
let out = '', let out = '',
@@ -466,5 +466,5 @@ export class Lexer { @@ -478,5 +478,5 @@ export class Lexer {
// autolink // autolink
- if (token = this.tokenizer.autolink(src, mangle)) { - if (token = this.tokenizer.autolink(src, mangle)) {
+ if (token = this.tokenizer.autolink(src)) { + if (token = this.tokenizer.autolink(src)) {
src = src.substring(token.raw.length); src = src.substring(token.raw.length);
tokens.push(token); tokens.push(token);
@@ -473,5 +473,5 @@ export class Lexer { @@ -485,5 +485,5 @@ export class Lexer {
// url (gfm) // url (gfm)
- if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) { - if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
+ if (!this.state.inLink && (token = this.tokenizer.url(src))) { + if (!this.state.inLink && (token = this.tokenizer.url(src))) {
src = src.substring(token.raw.length); src = src.substring(token.raw.length);
tokens.push(token); tokens.push(token);
@@ -494,5 +494,5 @@ export class Lexer { @@ -506,5 +506,5 @@ export class Lexer {
} }
} }
- if (token = this.tokenizer.inlineText(cutSrc, smartypants)) { - if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
@ -39,15 +39,15 @@ diff --git a/src/Lexer.js b/src/Lexer.js
diff --git a/src/Renderer.js b/src/Renderer.js diff --git a/src/Renderer.js b/src/Renderer.js
--- a/src/Renderer.js --- a/src/Renderer.js
+++ b/src/Renderer.js +++ b/src/Renderer.js
@@ -142,5 +142,5 @@ export class Renderer { @@ -173,5 +173,5 @@ export class Renderer {
*/
link(href, title, text) { link(href, title, text) {
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); - href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ href = cleanUrl(this.options.baseUrl, href); + href = cleanUrl(this.options.baseUrl, href);
if (href === null) { if (href === null) {
return text; return text;
@@ -155,5 +155,5 @@ export class Renderer { @@ -191,5 +191,5 @@ export class Renderer {
*/
image(href, title, text) { image(href, title, text) {
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); - href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ href = cleanUrl(this.options.baseUrl, href); + href = cleanUrl(this.options.baseUrl, href);
@ -56,7 +56,7 @@ diff --git a/src/Renderer.js b/src/Renderer.js
diff --git a/src/Tokenizer.js b/src/Tokenizer.js diff --git a/src/Tokenizer.js b/src/Tokenizer.js
--- a/src/Tokenizer.js --- a/src/Tokenizer.js
+++ b/src/Tokenizer.js +++ b/src/Tokenizer.js
@@ -320,14 +320,7 @@ export class Tokenizer { @@ -352,14 +352,7 @@ export class Tokenizer {
type: 'html', type: 'html',
raw: cap[0], raw: cap[0],
- pre: !this.options.sanitizer - pre: !this.options.sanitizer
@ -65,14 +65,14 @@ diff --git a/src/Tokenizer.js b/src/Tokenizer.js
text: cap[0] text: cap[0]
}; };
- if (this.options.sanitize) { - if (this.options.sanitize) {
- const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
- token.type = 'paragraph'; - token.type = 'paragraph';
- token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]); - token.text = text;
- token.tokens = []; - token.tokens = this.lexer.inline(text);
- this.lexer.inline(token.text, token.tokens);
- } - }
return token; return token;
} }
@@ -476,15 +469,9 @@ export class Tokenizer { @@ -502,15 +495,9 @@ export class Tokenizer {
return { return {
- type: this.options.sanitize - type: this.options.sanitize
@ -90,7 +90,7 @@ diff --git a/src/Tokenizer.js b/src/Tokenizer.js
+ text: cap[0] + text: cap[0]
}; };
} }
@@ -671,10 +658,10 @@ export class Tokenizer { @@ -699,10 +686,10 @@ export class Tokenizer {
} }
- autolink(src, mangle) { - autolink(src, mangle) {
@ -103,7 +103,7 @@ diff --git a/src/Tokenizer.js b/src/Tokenizer.js
+ text = escape(cap[1]); + text = escape(cap[1]);
href = 'mailto:' + text; href = 'mailto:' + text;
} else { } else {
@@ -699,10 +686,10 @@ export class Tokenizer { @@ -727,10 +714,10 @@ export class Tokenizer {
} }
- url(src, mangle) { - url(src, mangle) {
@ -116,7 +116,7 @@ diff --git a/src/Tokenizer.js b/src/Tokenizer.js
+ text = escape(cap[0]); + text = escape(cap[0]);
href = 'mailto:' + text; href = 'mailto:' + text;
} else { } else {
@@ -736,12 +723,12 @@ export class Tokenizer { @@ -764,12 +751,12 @@ export class Tokenizer {
} }
- inlineText(src, smartypants) { - inlineText(src, smartypants) {
@ -135,7 +135,7 @@ diff --git a/src/Tokenizer.js b/src/Tokenizer.js
diff --git a/src/defaults.js b/src/defaults.js diff --git a/src/defaults.js b/src/defaults.js
--- a/src/defaults.js --- a/src/defaults.js
+++ b/src/defaults.js +++ b/src/defaults.js
@@ -9,12 +9,8 @@ export function getDefaults() { @@ -10,11 +10,7 @@ export function getDefaults() {
highlight: null, highlight: null,
langPrefix: 'language-', langPrefix: 'language-',
- mangle: true, - mangle: true,
@ -144,16 +144,15 @@ diff --git a/src/defaults.js b/src/defaults.js
- sanitize: false, - sanitize: false,
- sanitizer: null, - sanitizer: null,
silent: false, silent: false,
smartLists: false,
- smartypants: false, - smartypants: false,
tokenizer: null, tokenizer: null,
walkTokens: null, walkTokens: null,
diff --git a/src/helpers.js b/src/helpers.js diff --git a/src/helpers.js b/src/helpers.js
--- a/src/helpers.js --- a/src/helpers.js
+++ b/src/helpers.js +++ b/src/helpers.js
@@ -64,18 +64,5 @@ export function edit(regex, opt) { @@ -78,18 +78,5 @@ const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
const nonWordAndColonTest = /[^\w:]/g; * @param {string} href
const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; */
-export function cleanUrl(sanitize, base, href) { -export function cleanUrl(sanitize, base, href) {
- if (sanitize) { - if (sanitize) {
- let prot; - let prot;
@ -171,7 +170,7 @@ diff --git a/src/helpers.js b/src/helpers.js
+export function cleanUrl(base, href) { +export function cleanUrl(base, href) {
if (base && !originIndependentUrl.test(href)) { if (base && !originIndependentUrl.test(href)) {
href = resolveUrl(base, href); href = resolveUrl(base, href);
@@ -227,10 +214,4 @@ export function findClosingBracket(str, b) { @@ -250,10 +237,4 @@ export function findClosingBracket(str, b) {
} }
-export function checkSanitizeDeprecation(opt) { -export function checkSanitizeDeprecation(opt) {
@ -181,7 +180,7 @@ diff --git a/src/helpers.js b/src/helpers.js
-} -}
- -
// copied from https://stackoverflow.com/a/5450113/806777 // copied from https://stackoverflow.com/a/5450113/806777
export function repeatString(pattern, count) { /**
diff --git a/src/marked.js b/src/marked.js diff --git a/src/marked.js b/src/marked.js
--- a/src/marked.js --- a/src/marked.js
+++ b/src/marked.js +++ b/src/marked.js
@ -197,13 +196,13 @@ diff --git a/src/marked.js b/src/marked.js
- checkSanitizeDeprecation(opt); - checkSanitizeDeprecation(opt);
if (callback) { if (callback) {
@@ -302,5 +300,4 @@ marked.parseInline = function(src, opt) { @@ -318,5 +316,4 @@ marked.parseInline = function(src, opt) {
opt = merge({}, marked.defaults, opt || {}); opt = merge({}, marked.defaults, opt || {});
- checkSanitizeDeprecation(opt); - checkSanitizeDeprecation(opt);
try { try {
@@ -311,5 +308,5 @@ marked.parseInline = function(src, opt) { @@ -327,5 +324,5 @@ marked.parseInline = function(src, opt) {
return Parser.parseInline(tokens, opt); return Parser.parseInline(tokens, opt);
} catch (e) { } catch (e) {
- e.message += '\nPlease report this to https://github.com/markedjs/marked.'; - e.message += '\nPlease report this to https://github.com/markedjs/marked.';
@ -213,42 +212,24 @@ diff --git a/src/marked.js b/src/marked.js
diff --git a/test/bench.js b/test/bench.js diff --git a/test/bench.js b/test/bench.js
--- a/test/bench.js --- a/test/bench.js
+++ b/test/bench.js +++ b/test/bench.js
@@ -37,5 +37,4 @@ export async function runBench(options) { @@ -39,5 +39,4 @@ export async function runBench(options) {
breaks: false, breaks: false,
pedantic: false, pedantic: false,
- sanitize: false, - sanitize: false
smartLists: false
}); });
@@ -49,5 +48,4 @@ export async function runBench(options) { if (options.marked) {
@@ -50,5 +49,4 @@ export async function runBench(options) {
breaks: false, breaks: false,
pedantic: false, pedantic: false,
- sanitize: false, - sanitize: false
smartLists: false
});
@@ -62,5 +60,4 @@ export async function runBench(options) {
breaks: false,
pedantic: false,
- sanitize: false,
smartLists: false
});
@@ -74,5 +71,4 @@ export async function runBench(options) {
breaks: false,
pedantic: false,
- sanitize: false,
smartLists: false
});
@@ -87,5 +83,4 @@ export async function runBench(options) {
breaks: false,
pedantic: true,
- sanitize: false,
smartLists: false
});
@@ -99,5 +94,4 @@ export async function runBench(options) {
breaks: false,
pedantic: true,
- sanitize: false,
smartLists: false
}); });
if (options.marked) {
@@ -61,5 +59,4 @@ export async function runBench(options) {
// breaks: false,
// pedantic: false,
- // sanitize: false
// });
// if (options.marked) {
diff --git a/test/specs/run-spec.js b/test/specs/run-spec.js diff --git a/test/specs/run-spec.js b/test/specs/run-spec.js
--- a/test/specs/run-spec.js --- a/test/specs/run-spec.js
+++ b/test/specs/run-spec.js +++ b/test/specs/run-spec.js
@ -269,70 +250,70 @@ diff --git a/test/specs/run-spec.js b/test/specs/run-spec.js
diff --git a/test/unit/Lexer-spec.js b/test/unit/Lexer-spec.js diff --git a/test/unit/Lexer-spec.js b/test/unit/Lexer-spec.js
--- a/test/unit/Lexer-spec.js --- a/test/unit/Lexer-spec.js
+++ b/test/unit/Lexer-spec.js +++ b/test/unit/Lexer-spec.js
@@ -635,5 +635,5 @@ paragraph @@ -712,5 +712,5 @@ paragraph
}); });
- it('sanitize', () => { - it('sanitize', () => {
+ /*it('sanitize', () => { + /*it('sanitize', () => {
expectTokens({ expectTokens({
md: '<div>html</div>', md: '<div>html</div>',
@@ -653,5 +653,5 @@ paragraph @@ -730,5 +730,5 @@ paragraph
] ]
}); });
- }); - });
+ });*/ + });*/
}); });
@@ -698,5 +698,5 @@ paragraph @@ -810,5 +810,5 @@ paragraph
}); });
- it('html sanitize', () => { - it('html sanitize', () => {
+ /*it('html sanitize', () => { + /*it('html sanitize', () => {
expectInlineTokens({ expectInlineTokens({
md: '<div>html</div>', md: '<div>html</div>',
@@ -706,5 +706,5 @@ paragraph @@ -818,5 +818,5 @@ paragraph
] ]
}); });
- }); - });
+ });*/ + });*/
it('link', () => { it('link', () => {
@@ -1017,5 +1017,5 @@ paragraph @@ -1129,5 +1129,5 @@ paragraph
}); });
- it('autolink mangle email', () => { - it('autolink mangle email', () => {
+ /*it('autolink mangle email', () => { + /*it('autolink mangle email', () => {
expectInlineTokens({ expectInlineTokens({
md: '<test@example.com>', md: '<test@example.com>',
@@ -1037,5 +1037,5 @@ paragraph @@ -1149,5 +1149,5 @@ paragraph
] ]
}); });
- }); - });
+ });*/ + });*/
it('url', () => { it('url', () => {
@@ -1074,5 +1074,5 @@ paragraph @@ -1186,5 +1186,5 @@ paragraph
}); });
- it('url mangle email', () => { - it('url mangle email', () => {
+ /*it('url mangle email', () => { + /*it('url mangle email', () => {
expectInlineTokens({ expectInlineTokens({
md: 'test@example.com', md: 'test@example.com',
@@ -1094,5 +1094,5 @@ paragraph @@ -1206,5 +1206,5 @@ paragraph
] ]
}); });
- }); - });
+ });*/ + });*/
}); });
@@ -1110,5 +1110,5 @@ paragraph @@ -1222,5 +1222,5 @@ paragraph
}); });
- describe('smartypants', () => { - describe('smartypants', () => {
+ /*describe('smartypants', () => { + /*describe('smartypants', () => {
it('single quotes', () => { it('single quotes', () => {
expectInlineTokens({ expectInlineTokens({
@@ -1180,5 +1180,5 @@ paragraph @@ -1292,5 +1292,5 @@ paragraph
}); });
}); });
- }); - });