From c0c09f9a5d82cfc6ebc72f9b0af10f69a5ab10e7 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 18 Aug 2024 13:58:47 +0300 Subject: [PATCH] Don't replace underscore italics inside of code blocks --- public/scripts/showdown-underscore.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/scripts/showdown-underscore.js b/public/scripts/showdown-underscore.js index 78a1adef7..cea67cf00 100644 --- a/public/scripts/showdown-underscore.js +++ b/public/scripts/showdown-underscore.js @@ -8,8 +8,16 @@ export const markdownUnderscoreExt = () => { return [{ type: 'lang', - regex: new RegExp('\\b(?$1', + regex: new RegExp('(`{1,3}).*?\\1|\\b(?${italicContent}`; + } + }, }]; } catch (e) { console.error('Error in Showdown-underscore extension:', e);