From 42424228988c8bf4ea9a4fb60fd9bbd08e758960 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 2 Dec 2022 21:39:04 +0000 Subject: [PATCH] update deps: marked.js, codemirror --- scripts/deps-docker/Dockerfile | 7 +- scripts/deps-docker/marked-ln.patch | 12 +-- scripts/deps-docker/marked.patch | 117 ++++++++++++---------------- 3 files changed, 59 insertions(+), 77 deletions(-) diff --git a/scripts/deps-docker/Dockerfile b/scripts/deps-docker/Dockerfile index 96e6482b..e83360cf 100644 --- a/scripts/deps-docker/Dockerfile +++ b/scripts/deps-docker/Dockerfile @@ -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 ENV ver_asmcrypto=c72492f4a66e17a0e5dd8ad7874de354f3ccdaa5 \ ver_hashwasm=4.9.0 \ - ver_marked=4.0.18 \ + ver_marked=4.2.3 \ ver_mde=2.18.0 \ - ver_codemirror=5.65.9 \ + ver_codemirror=5.65.10 \ ver_fontawesome=5.13.0 \ ver_zopfli=1.0.3 diff --git a/scripts/deps-docker/marked-ln.patch b/scripts/deps-docker/marked-ln.patch index 9a60a8ea..65a78be2 100644 --- a/scripts/deps-docker/marked-ln.patch +++ b/scripts/deps-docker/marked-ln.patch @@ -1,5 +1,5 @@ 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 --- a/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++; lastToken = tokens[tokens.length - 1]; 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)) { src = src.substring(token.raw.length); + this.ln = token.ln || this.ln; tokens.push(token); return true; -@@ -430,4 +462,6 @@ export class Lexer { +@@ -432,4 +464,6 @@ export class Lexer { if (token = this.tokenizer.br(src)) { src = src.substring(token.raw.length); + // no need to reset (no more blockTokens anyways) + token.ln = this.ln++; tokens.push(token); continue; -@@ -472,4 +506,5 @@ export class Lexer { +@@ -474,4 +508,5 @@ export class Lexer { if (token = this.tokenizer.inlineText(cutSrc, smartypants)) { src = src.substring(token.raw.length); + this.ln = token.ln || this.ln; @@ -234,7 +234,7 @@ index 7c36a75..aa1a53a 100644 - return '
 {
 +    /*it('sanitize', () => {
        expectTokens({
          md: '
html
', -@@ -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', () => { expectInlineTokens({ md: '
html
', -@@ -706,5 +706,5 @@ paragraph +@@ -818,5 +818,5 @@ paragraph ] }); - }); + });*/ it('link', () => { -@@ -1017,5 +1017,5 @@ paragraph +@@ -1129,5 +1129,5 @@ paragraph }); - it('autolink mangle email', () => { + /*it('autolink mangle email', () => { expectInlineTokens({ md: '', -@@ -1037,5 +1037,5 @@ paragraph +@@ -1149,5 +1149,5 @@ paragraph ] }); - }); + });*/ it('url', () => { -@@ -1074,5 +1074,5 @@ paragraph +@@ -1186,5 +1186,5 @@ paragraph }); - it('url mangle email', () => { + /*it('url mangle email', () => { expectInlineTokens({ 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', () => { it('single quotes', () => { expectInlineTokens({ -@@ -1180,5 +1180,5 @@ paragraph +@@ -1292,5 +1292,5 @@ paragraph }); }); - });