From b6bc81314ca3021beef90d95ae99f5cc1cc2eb60 Mon Sep 17 00:00:00 2001 From: Maddison Hellstrom Date: Sat, 6 Feb 2021 07:18:19 -0800 Subject: [PATCH] [src:tweak] workaround external bug --- actions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/actions.js b/actions.js index 464f23b..2edbe74 100644 --- a/actions.js +++ b/actions.js @@ -32,7 +32,13 @@ actions.copyOrgLink = () => Clipboard.write(`[[${util.getCurrentLocation("href")}][${document.title}]]`) // TODO: use navigator.clipboard actions.copyMarkdownLink = () => - Clipboard.write(`[${document.title}](${util.getCurrentLocation("href")})`) // TODO: use navigator.clipboard + Clipboard.write( + // I mostly use this feature to paste links into my Neuron (github.com/srid/neuron) notes. + // Due to a bug in Neuron's markdown library (github.com/jgm/commonmark-hs/issues/52), + // the vertical bar character breaks lists and titles. + // As a workaround, we backslash-escape any vertical bar characters. + `[${document.title.replace("|", "\\|")}](${util.getCurrentLocation("href")})`, + ) actions.duplicateTab = () => actions.openLink(util.getCurrentLocation("href"), { newTab: true, active: false })()