From 29d7e91c9814e683e75ce7b890f7f74e66d224d8 Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Tue, 23 Apr 2024 13:28:55 +0200 Subject: [PATCH] fix link markdown issue --- labscore/utils/markdown.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/labscore/utils/markdown.js b/labscore/utils/markdown.js index 969c6a5..9c9d705 100644 --- a/labscore/utils/markdown.js +++ b/labscore/utils/markdown.js @@ -21,8 +21,8 @@ module.exports.codeblock = function(type, content = ""){ module.exports.link = function(url, masked, tooltip = "", embed = false){ if(tooltip.length) tooltip = ` '${tooltip}'` - if(masked && !embed) return `[${masked}](<${url}>${tooltip})` - if(masked && embed) return `[${masked}](${url}${tooltip})` + if(masked && !embed) return `[${masked}](<${url.replace(/\)/g, '\\)')}>${tooltip})` + if(masked && embed) return `[${masked}](${url.replace(/\)/g, '\\)')}${tooltip})` return url } @@ -61,12 +61,12 @@ module.exports.smallIconPill = function(icon, content = ""){ module.exports.iconLinkPill = function(icon, url, content = "", tooltip = ""){ if(!ICONS[icon]) icon = "question" if(tooltip.length) tooltip = ` '${tooltip}'` - if(content) return `${ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:')} [**\` ${content.toString().replace(/\`/g, 'ˋ')} \`**](${url}${tooltip})` + if(content) return `${ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:')} [**\` ${content.toString().replace(/\`/g, 'ˋ')} \`**](${url.replace(/\)/g, '\\)')}${tooltip})` return url } module.exports.linkPill = function(url, content = "", tooltip = ""){ if(tooltip.length) tooltip = ` '${tooltip}'` - if(content) return `[**\` ${content.toString().replace(/\`/g, 'ˋ')} \`**](${url}${tooltip})` + if(content) return `[**\` ${content.toString().replace(/\`/g, 'ˋ')} \`**](${url.replace(/\)/g, '\\)')}${tooltip})` return url }