From eeb7d79248c93f9cdec3d2ad2a443c38a378f60c Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 09:13:36 +0200 Subject: [PATCH 01/32] Update dark-theme.css --- dark-theme.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dark-theme.css b/dark-theme.css index c86b3d23c3..0629f6af9f 100644 --- a/dark-theme.css +++ b/dark-theme.css @@ -133,7 +133,8 @@ cd-el { .token.atrule, .token.url .token.content, .token.url-reference .token.variable, -.language-markdown .token.code-block .token.punctuation { +.language-markdown .token.code-block .token.punctuation, +.language-markdown .token.tag .token.punctuation { color: #a6c3d4; } From 465773c36083ba3c41d609940872b5b54fb3234d Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 09:14:14 +0200 Subject: [PATCH 02/32] Update full.css --- full.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/full.css b/full.css index a19afffb3d..c87c2d7bb0 100644 --- a/full.css +++ b/full.css @@ -1665,10 +1665,14 @@ body:not(.mobile) .menu::-webkit-scrollbar-thumb { background-color: rgb(130 134 137 / 50%); } -body:not(.mobile) .menu::-webkit-scrollbar-thumb:not(:active):hover { +body:not(.mobile) .menu::-webkit-scrollbar-thumb:hover { background-color: rgb(130 134 137 / 65%); } +body:not(.mobile) .menu::-webkit-scrollbar-thumb:active { + background-color: rgb(130 134 137 / 50%); +} + .menu .icon { padding: 10px 15px; padding: 8px 13px; From fd9df295006f0fc0059f0551411f1a03c1968d48 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 09:17:01 +0200 Subject: [PATCH 03/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index e81cc00096..2d46efe417 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -4,7 +4,7 @@ return; } - var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&@]+(?:\?[\w\-+%~/.:=?&!$'()*,;@]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;@]*)?/; + var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&!$'()*,;@]+(?:\?[\w\-+%~/.:=?&!$'()*,;@]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;@]*)?/; var email = /\b\S+@[\w.]+[a-z]{2}/; var linkMd = /\[([^\]]+)\]\(([^)]+)\)/; @@ -44,15 +44,12 @@ } }; - Prism.hooks.add('before-tokenize', function (env) { - if (env.language !== 'markdown') { - Prism.plugins.autolinker.processGrammar(env.grammar); - } + Prism.hooks.add('before-highlight', function (env) { + Prism.plugins.autolinker.processGrammar(env.grammar); }); - Prism.hooks.add('wrap', function (env) { - if (env.language !== 'markdown') { - if (/-link$/.test(env.type)) { + Prism.hooks.add('wrap', function (env) { + if (/-link$/.test(env.type)) { env.tag = 'a'; var href = env.content; @@ -60,7 +57,7 @@ if (env.type == 'email-link' && href.indexOf('mailto:') != 0) { href = 'mailto:' + href; } else if (env.type == 'md-link') { - // Markdown + // markdown var match = env.content.match(linkMd); href = match[2]; @@ -69,8 +66,9 @@ var isMac = navigator.platform.indexOf('Mac') > -1; - env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); - + //env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); + env.attributes.href = href; + env.attributes.onclick = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }'; env.attributes.title = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link'; From 0b64812c90e5b03d9962db5b179f3d1965633619 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 09:19:09 +0200 Subject: [PATCH 04/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 41 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 2d46efe417..f7be4f8400 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -50,33 +50,32 @@ Prism.hooks.add('wrap', function (env) { if (/-link$/.test(env.type)) { - env.tag = 'a'; + env.tag = 'a'; - var href = env.content; + var href = env.content; - if (env.type == 'email-link' && href.indexOf('mailto:') != 0) { - href = 'mailto:' + href; - } else if (env.type == 'md-link') { - // markdown - var match = env.content.match(linkMd); + if (env.type == 'email-link' && href.indexOf('mailto:') != 0) { + href = 'mailto:' + href; + } else if (env.type == 'md-link') { + // markdown + var match = env.content.match(linkMd); - href = match[2]; - env.content = match[1]; - } + href = match[2]; + env.content = match[1]; + } - var isMac = navigator.platform.indexOf('Mac') > -1; + var isMac = navigator.platform.indexOf('Mac') > -1; - //env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); - env.attributes.href = href; - - env.attributes.onclick = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }'; - env.attributes.title = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link'; + //env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); + env.attributes.href = href; - // silently catch any error thrown by decodeURIComponent - try { - env.content = decodeURIComponent(env.content); - } catch (e) {} - } + env.attributes.onclick = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }'; + env.attributes.title = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link'; + + // silently catch any error thrown by decodeURIComponent + try { + env.content = decodeURIComponent(env.content); + } catch (e) {} } }); From c427ff37813bb0b3553b21896b00b811e132368f Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 09:23:02 +0200 Subject: [PATCH 05/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index f7be4f8400..88d64fb9f6 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -44,7 +44,7 @@ } }; - Prism.hooks.add('before-highlight', function (env) { + Prism.hooks.add('before-tokenize', function (env) { Prism.plugins.autolinker.processGrammar(env.grammar); }); From 70d884304217e0b829b593a3e89c656ea4c5b2e5 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 11:36:52 +0200 Subject: [PATCH 06/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 88d64fb9f6..682b111fe5 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -51,7 +51,11 @@ Prism.hooks.add('wrap', function (env) { if (/-link$/.test(env.type)) { env.tag = 'a'; - + + var match = env.content.match(linkMd); + + console.log(env.content, env.type, match, env); + var href = env.content; if (env.type == 'email-link' && href.indexOf('mailto:') != 0) { From e416e8fed9ca6836c20524d54be8a7e9a999c47c Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 11:48:54 +0200 Subject: [PATCH 07/32] Update markdown-dark.css --- live-view/extensions/markdown-dark.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/live-view/extensions/markdown-dark.css b/live-view/extensions/markdown-dark.css index 8f5d910c3a..b44aa0f7c0 100644 --- a/live-view/extensions/markdown-dark.css +++ b/live-view/extensions/markdown-dark.css @@ -207,10 +207,10 @@ body table { -webkit-appearance: none; } -body table::-webkit-scrollbar-track { +body:not(.mobile) table::-webkit-scrollbar-track { border-radius: 0 0 10px 10px; background-color: var(--color-canvas-default) !important; - box-shadow: inset 0px 1px 0 0 var(--color-border-default) !important; + box-shadow: inset 0 1px 0 0 var(--table-border-color); } body thead { @@ -286,7 +286,7 @@ body cd-el { cursor: unset; } -body cd-el::-webkit-scrollbar-track { +body:not(.mobile) cd-el::-webkit-scrollbar-track { border-radius: 0 0 10px 10px; } From 60d6b1464d99b6d8bb4069bac518020c89441c91 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 11:54:23 +0200 Subject: [PATCH 08/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 682b111fe5..312d47b84b 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -26,6 +26,9 @@ } def.inside = def.inside || {}; + + console.log(grammar, key, def, type); + //env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); if (type == 'comment') { def.inside['md-link'] = linkMd; From ad137dc040967a45a1b5adafd562410c35edcf89 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 11:56:02 +0200 Subject: [PATCH 09/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 312d47b84b..fdc9a4a5b0 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -54,11 +54,7 @@ Prism.hooks.add('wrap', function (env) { if (/-link$/.test(env.type)) { env.tag = 'a'; - - var match = env.content.match(linkMd); - - console.log(env.content, env.type, match, env); - + var href = env.content; if (env.type == 'email-link' && href.indexOf('mailto:') != 0) { @@ -73,8 +69,7 @@ var isMac = navigator.platform.indexOf('Mac') > -1; - //env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); - env.attributes.href = href; + env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); env.attributes.onclick = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }'; env.attributes.title = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link'; From 52857b3603c62e4f5df7bc42983aabfbc42bab40 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:16:58 +0200 Subject: [PATCH 10/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index fdc9a4a5b0..b6d6beea4f 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -13,7 +13,7 @@ Prism.plugins.autolinker = { processGrammar: function (grammar) { - // Abort if grammar has already been processed + // abort if grammar has already been processed if (!grammar || grammar['url-link']) { return; } @@ -27,8 +27,7 @@ def.inside = def.inside || {}; - console.log(grammar, key, def, type); - //env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); + console.log('url', url); if (type == 'comment') { def.inside['md-link'] = linkMd; From 90a255605392ca9130a990b9ead19490fe0fc735 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:18:58 +0200 Subject: [PATCH 11/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index b6d6beea4f..645392e684 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -26,10 +26,8 @@ } def.inside = def.inside || {}; - - console.log('url', url); - if (type == 'comment') { + if (type == 'comment' || type == 'url') { def.inside['md-link'] = linkMd; } if (type == 'attr-value') { @@ -64,6 +62,7 @@ href = match[2]; env.content = match[1]; + console.log(env.content); } var isMac = navigator.platform.indexOf('Mac') > -1; From 1f89cd0a52c3dfa2279ae88e2f54c631635e8346 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:20:16 +0200 Subject: [PATCH 12/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 645392e684..21e864e93f 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -26,8 +26,10 @@ } def.inside = def.inside || {}; - - if (type == 'comment' || type == 'url') { + + console.log(type); + + if (type == 'comment') { def.inside['md-link'] = linkMd; } if (type == 'attr-value') { From 327c71dee45e2ea794a06131cd5e7542ba33322e Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:23:59 +0200 Subject: [PATCH 13/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 21e864e93f..d78ace9ff5 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -27,8 +27,6 @@ def.inside = def.inside || {}; - console.log(type); - if (type == 'comment') { def.inside['md-link'] = linkMd; } @@ -47,10 +45,12 @@ }; Prism.hooks.add('before-tokenize', function (env) { + if (env.lang === 'markdown') return; Prism.plugins.autolinker.processGrammar(env.grammar); }); Prism.hooks.add('wrap', function (env) { + if (env.lang === 'markdown') return; if (/-link$/.test(env.type)) { env.tag = 'a'; @@ -64,7 +64,6 @@ href = match[2]; env.content = match[1]; - console.log(env.content); } var isMac = navigator.platform.indexOf('Mac') > -1; From 3f895a25fee6bd09fa2e6365af238e3e3690c10b Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:32:16 +0200 Subject: [PATCH 14/32] Update dark-theme.css --- dark-theme.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dark-theme.css b/dark-theme.css index 0629f6af9f..c1011da11d 100644 --- a/dark-theme.css +++ b/dark-theme.css @@ -241,6 +241,10 @@ cd-el { text-decoration: underline; } +.token.strike .token.content { + text-decoration: line-through; +} + .token.brace.brace-active { position: relative; From 70296d90ab2685d3df2a791c726412307d210e8f Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:33:05 +0200 Subject: [PATCH 15/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index d78ace9ff5..c7a350dad6 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -50,6 +50,7 @@ }); Prism.hooks.add('wrap', function (env) { + console.log(env); if (env.lang === 'markdown') return; if (/-link$/.test(env.type)) { env.tag = 'a'; From 1a645dc57e9e809e55d5ca94291b67a2ad408f44 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:40:34 +0200 Subject: [PATCH 16/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index c7a350dad6..cf3b465096 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -45,13 +45,26 @@ }; Prism.hooks.add('before-tokenize', function (env) { - if (env.lang === 'markdown') return; + //if (env.lang === 'markdown') return; Prism.plugins.autolinker.processGrammar(env.grammar); }); Prism.hooks.add('wrap', function (env) { console.log(env); - if (env.lang === 'markdown') return; + //if (env.lang === 'markdown') return; + + if (env.type === 'url-reference') { + + let splitContent = env.content.split(' '); + + let href = splitContent[splitContent.length - 1]; + + console.log(href); + + splitContent[splitContent.length - 1] = '' + href + ''; + + } + if (/-link$/.test(env.type)) { env.tag = 'a'; From e22ea2286e7828ec3c9cf8c7c75842bd49490ddc Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:42:25 +0200 Subject: [PATCH 17/32] Update codeit-match-braces.js --- lib/plugins/codeit-match-braces.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/plugins/codeit-match-braces.js b/lib/plugins/codeit-match-braces.js index 013a4a6e77..88c66ee26e 100644 --- a/lib/plugins/codeit-match-braces.js +++ b/lib/plugins/codeit-match-braces.js @@ -155,7 +155,9 @@ } Prism.hooks.add('complete', function (env) { - + + if (env.language === 'markdown') return; + var code = env.element; rematch(code); From e270604b3af92a2e931ecd787877babcf2d9c56f Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:48:40 +0200 Subject: [PATCH 18/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index cf3b465096..856c6a26ac 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -63,6 +63,8 @@ splitContent[splitContent.length - 1] = '' + href + ''; + env.content = splitContent.join(' '); + } if (/-link$/.test(env.type)) { From d053e0f8e4f4851fc438853fa56c1964d46c24d5 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:51:02 +0200 Subject: [PATCH 19/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 856c6a26ac..0f60c6f0d8 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -45,16 +45,18 @@ }; Prism.hooks.add('before-tokenize', function (env) { - //if (env.lang === 'markdown') return; + //if (env.language === 'markdown') return; Prism.plugins.autolinker.processGrammar(env.grammar); }); Prism.hooks.add('wrap', function (env) { - console.log(env); - //if (env.lang === 'markdown') return; + + //if (env.language === 'markdown') return; if (env.type === 'url-reference') { + console.log(env.content.match(url)); + let splitContent = env.content.split(' '); let href = splitContent[splitContent.length - 1]; From ae20f70e8fa9100d4bfa899911c1db28bb47abaa Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:55:43 +0200 Subject: [PATCH 20/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 0f60c6f0d8..b18449b5c0 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -48,24 +48,29 @@ //if (env.language === 'markdown') return; Prism.plugins.autolinker.processGrammar(env.grammar); }); - + + + const onClickEvent = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }'; + + const isMac = navigator.platform.indexOf('Mac') > -1; + + const linkTitle = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link'; + Prism.hooks.add('wrap', function (env) { //if (env.language === 'markdown') return; if (env.type === 'url-reference') { - console.log(env.content.match(url)); - - let splitContent = env.content.split(' '); - - let href = splitContent[splitContent.length - 1]; - - console.log(href); - - splitContent[splitContent.length - 1] = '' + href + ''; + let matches = env.content.match(url); - env.content = splitContent.join(' '); + if (matches && matches[0]) { + + matches[0] = matches[0].replaceAll('\'','').replaceAll('"','').replaceAll('`',''); + + env.content.replace(matches[0], '' + matches[0] + ''); + + } } @@ -83,13 +88,11 @@ href = match[2]; env.content = match[1]; } - - var isMac = navigator.platform.indexOf('Mac') > -1; - + env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`',''); - env.attributes.onclick = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }'; - env.attributes.title = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link'; + env.attributes.onclick = onClickEvent; + env.attributes.title = linkTitle; // silently catch any error thrown by decodeURIComponent try { From 2dd30cdd2d5ab23b57c908635849c565f81a6f7f Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:56:47 +0200 Subject: [PATCH 21/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index b18449b5c0..232d96cf1d 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -66,6 +66,8 @@ if (matches && matches[0]) { + console.log(matches); + matches[0] = matches[0].replaceAll('\'','').replaceAll('"','').replaceAll('`',''); env.content.replace(matches[0], '' + matches[0] + ''); From 43655c9a9c9aceb9b8f3676b214de8ee89bba7f8 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:57:40 +0200 Subject: [PATCH 22/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 232d96cf1d..07e4b27898 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -66,10 +66,10 @@ if (matches && matches[0]) { - console.log(matches); - matches[0] = matches[0].replaceAll('\'','').replaceAll('"','').replaceAll('`',''); + console.log(matches[0]); + env.content.replace(matches[0], '' + matches[0] + ''); } From b4682c024122cb4479e2fbd8563f67b013bf1890 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:58:49 +0200 Subject: [PATCH 23/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 07e4b27898..38a35af942 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -60,18 +60,18 @@ //if (env.language === 'markdown') return; - if (env.type === 'url-reference') { + if (env.language === 'markdown' && + env.type === 'url-reference') { let matches = env.content.match(url); if (matches && matches[0]) { matches[0] = matches[0].replaceAll('\'','').replaceAll('"','').replaceAll('`',''); - - console.log(matches[0]); - + env.content.replace(matches[0], '' + matches[0] + ''); + console.log(env.content); } } From 4d0200c37d3610dd74fbbba7f923c92333e46e14 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:00:00 +0200 Subject: [PATCH 24/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 38a35af942..0bea8b2d80 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -69,9 +69,8 @@ matches[0] = matches[0].replaceAll('\'','').replaceAll('"','').replaceAll('`',''); - env.content.replace(matches[0], '' + matches[0] + ''); + env.content = env.content.replace(matches[0], '' + matches[0] + ''); - console.log(env.content); } } From 9326accc94d2cbf19d1b94b0bf575c4c10264493 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:01:08 +0200 Subject: [PATCH 25/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 0bea8b2d80..eaa8ec6613 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -50,7 +50,7 @@ }); - const onClickEvent = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }'; + const onClickEvent = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, \"_blank\") }'; const isMac = navigator.platform.indexOf('Mac') > -1; @@ -69,7 +69,7 @@ matches[0] = matches[0].replaceAll('\'','').replaceAll('"','').replaceAll('`',''); - env.content = env.content.replace(matches[0], '' + matches[0] + ''); + env.content = env.content.replace(matches[0], '' + matches[0] + ''); } From ea843de525f51219bd239ed997ef909d86cf4962 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:02:18 +0200 Subject: [PATCH 26/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index eaa8ec6613..e3bfe34282 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -50,7 +50,7 @@ }); - const onClickEvent = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, \"_blank\") }'; + const onClickEvent = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, \'_blank\') }'; const isMac = navigator.platform.indexOf('Mac') > -1; From 6014627bb7bb2333da922bbed8bb5ef25dd22ceb Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:07:36 +0200 Subject: [PATCH 27/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index e3bfe34282..00badafcb5 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -13,10 +13,6 @@ Prism.plugins.autolinker = { processGrammar: function (grammar) { - // abort if grammar has already been processed - if (!grammar || grammar['url-link']) { - return; - } Prism.languages.DFS(grammar, function (key, def, type) { if (candidates.indexOf(type) > -1 && !Array.isArray(def)) { if (!def.pattern) { @@ -45,7 +41,6 @@ }; Prism.hooks.add('before-tokenize', function (env) { - //if (env.language === 'markdown') return; Prism.plugins.autolinker.processGrammar(env.grammar); }); From d3da9126f0cdbac6644576a917fa1d0b9d7be59b Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:09:32 +0200 Subject: [PATCH 28/32] Update codeit-autolinker.js --- lib/plugins/codeit-autolinker.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/plugins/codeit-autolinker.js b/lib/plugins/codeit-autolinker.js index 00badafcb5..cc212137de 100644 --- a/lib/plugins/codeit-autolinker.js +++ b/lib/plugins/codeit-autolinker.js @@ -13,6 +13,10 @@ Prism.plugins.autolinker = { processGrammar: function (grammar) { + // abort if grammar has already been processed + if (!grammar || grammar['url-link']) { + return; + } Prism.languages.DFS(grammar, function (key, def, type) { if (candidates.indexOf(type) > -1 && !Array.isArray(def)) { if (!def.pattern) { @@ -41,6 +45,7 @@ }; Prism.hooks.add('before-tokenize', function (env) { + if (env.language === 'markdown') return; Prism.plugins.autolinker.processGrammar(env.grammar); }); @@ -53,7 +58,7 @@ Prism.hooks.add('wrap', function (env) { - //if (env.language === 'markdown') return; + if (env.language === 'markdown') return; if (env.language === 'markdown' && env.type === 'url-reference') { From 0ef758fd99883b9e60958893114ce562339990b9 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Mon, 16 Jan 2023 22:04:30 +0200 Subject: [PATCH 29/32] Update codeit-match-braces.js --- lib/plugins/codeit-match-braces.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/plugins/codeit-match-braces.js b/lib/plugins/codeit-match-braces.js index 88c66ee26e..c46632ad5d 100644 --- a/lib/plugins/codeit-match-braces.js +++ b/lib/plugins/codeit-match-braces.js @@ -156,8 +156,6 @@ Prism.hooks.add('complete', function (env) { - if (env.language === 'markdown') return; - var code = env.element; rematch(code); From 085cd7484b3ca5ba016874fd26b6d8153cbe9c3f Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Mon, 16 Jan 2023 22:05:37 +0200 Subject: [PATCH 30/32] Update client-channel.js --- worker/client-channel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/client-channel.js b/worker/client-channel.js index ca64eda387..af4114d0d8 100644 --- a/worker/client-channel.js +++ b/worker/client-channel.js @@ -4,7 +4,7 @@ // update worker name when updating worker -const WORKER_NAME = 'codeit-worker-v625'; +const WORKER_NAME = 'codeit-worker-v626'; // internal paths From e3c21b20e532729cb6faa824a032061628372989 Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Mon, 16 Jan 2023 22:12:14 +0200 Subject: [PATCH 31/32] Update full.css --- full.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/full.css b/full.css index c87c2d7bb0..1f2bcee944 100644 --- a/full.css +++ b/full.css @@ -76,10 +76,12 @@ body.notransition .bottom-wrapper { } .bottom-wrapper.hidden { + pointer-events: none; transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px))); } .bottom-wrapper.expanded { + pointer-events: auto; transform: translateY(calc(-1 * var(--window-height, 100vh) + 44px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px))); height: 44px; } From 10056d9d97d32e0c19954b2f9f4be0404cd020ed Mon Sep 17 00:00:00 2001 From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com> Date: Mon, 16 Jan 2023 22:12:44 +0200 Subject: [PATCH 32/32] Update client-channel.js --- worker/client-channel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/client-channel.js b/worker/client-channel.js index af4114d0d8..5b6b9138cf 100644 --- a/worker/client-channel.js +++ b/worker/client-channel.js @@ -4,7 +4,7 @@ // update worker name when updating worker -const WORKER_NAME = 'codeit-worker-v626'; +const WORKER_NAME = 'codeit-worker-v627'; // internal paths