diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util/replacer.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/util/replacer.js b/src/util/replacer.js index 4bd99988..d1b0a269 100644 --- a/src/util/replacer.js +++ b/src/util/replacer.js @@ -613,9 +613,16 @@ export function postprocessExternalLinks(inputNodes) { while (plausibleMatch = plausibleLinkRegexp.exec(node.data)) { textContent += node.data.slice(parseFrom, plausibleMatch.index); + // Pedantic rules use more particular parentheses detection in link + // destinations - they allow one level of balanced parentheses, and + // otherwise, parentheses must be escaped. This allows for entire links + // to be wrapped in parentheses, e.g below: + // + // This is so cool. ([You know??](https://example.com)) + // const definiteMatch = - marked.Lexer.rules.inline.link.exec( - node.data.slice(plausibleMatch.index)); + marked.Lexer.rules.inline.pedantic.link + .exec(node.data.slice(plausibleMatch.index)); if (definiteMatch) { const {1: label, 2: href} = definiteMatch; |