diff --git a/app/Resources/Viewer/scripts/discord.js b/app/Resources/Viewer/scripts/discord.js index 9d576cc..90f71b1 100644 --- a/app/Resources/Viewer/scripts/discord.js +++ b/app/Resources/Viewer/scripts/discord.js @@ -1,7 +1,8 @@ const DISCORD = (function() { const regex = { formatBold: /\*\*([\s\S]+?)\*\*(?!\*)/g, - formatItalic: /(.)?([_*])([\s\S]+?)\2(?!\2)/g, + formatItalic1: /\*([\s\S]+?)\*(?!\*)/g, + formatItalic2: /_([\s\S]+?)_(?!_)\b/g, formatUnderline: /__([\s\S]+?)__(?!_)/g, formatStrike: /~~([\s\S]+?)~~(?!~)/g, formatCodeInline: /(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/g, @@ -48,7 +49,8 @@ const DISCORD = (function() { .replace(regex.specialEscapedDouble, full => full.replace(/\\/g, "").replace(/(.)/g, escapeHtmlMatch)) .replace(regex.formatBold, "$1") .replace(regex.formatUnderline, "$1") - .replace(regex.formatItalic, (full, pre, char, match) => pre === "\\" ? full : (pre || "") + "" + match + "") + .replace(regex.formatItalic1, "$1") + .replace(regex.formatItalic2, "$1") .replace(regex.formatStrike, "$1"); }