From 13623952285382273b695eb432808c2717c7e9aa Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Sun, 27 Aug 2023 13:52:18 +0200 Subject: [PATCH] fix markdown issue --- labscore/utils/markdown.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/labscore/utils/markdown.js b/labscore/utils/markdown.js index 4e513f3..7968e18 100644 --- a/labscore/utils/markdown.js +++ b/labscore/utils/markdown.js @@ -5,13 +5,13 @@ module.exports.icon = function(icon){ return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') } -module.exports.highlight = function(content){ - return "`" + content.replace(/\`/g, 'ˋ') + "`" +module.exports.highlight = function(content = ""){ + return "`" + content.toString().replace(/\`/g, 'ˋ') + "`" } -module.exports.codeblock = function(type, content){ +module.exports.codeblock = function(type, content = ""){ if(!content.length) return "```" + type + "\n```" - return "```" + type + "\n" + content.join('\n').replace(/\`/g, '`​') + "\n```" + return "```" + type + "\n" + content.toString().join('\n').replace(/\`/g, '`​') + "\n```" } module.exports.link = function(url, masked, tooltip = ""){ @@ -24,33 +24,33 @@ module.exports.timestamp = function(time, flag = "t"){ return `` } -module.exports.pill = function(content){ - return " **` " + content.replace(/\`/g, 'ˋ') + " `**" +module.exports.pill = function(content = ""){ + return " **` " + content.toString().replace(/\`/g, 'ˋ') + " `**" } -module.exports.smallPill = function(content){ - return " ` " + content.replace(/\`/g, 'ˋ') + " `" +module.exports.smallPill = function(content = ""){ + return " ` " + content.toString().replace(/\`/g, 'ˋ') + " `" } -module.exports.iconPill = function(icon, content){ +module.exports.iconPill = function(icon, content = ""){ if(!REDESIGN_ICONS[icon]) icon = "question" - return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " **` " + content.replace(/\`/g, 'ˋ') + " `**" + return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " **` " + content.toString().replace(/\`/g, 'ˋ') + " `**" } -module.exports.smallIconPill = function(icon, content){ +module.exports.smallIconPill = function(icon, content = ""){ if(!REDESIGN_ICONS[icon]) icon = "question" - return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " ` " + content.replace(/\`/g, 'ˋ') + " `" + return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " ` " + content.toString().replace(/\`/g, 'ˋ') + " `" } -module.exports.iconLinkPill = function(icon, url, content, tooltip = ""){ +module.exports.iconLinkPill = function(icon, url, content = "", tooltip = ""){ if(!REDESIGN_ICONS[icon]) icon = "question" if(tooltip.length) tooltip = ` '${tooltip}'` - if(content) return `${REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:')} [**\` ${content.replace(/\`/g, 'ˋ')} \`**](${url}${tooltip})` + if(content) return `${REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:')} [**\` ${content.toString().replace(/\`/g, 'ˋ')} \`**](${url}${tooltip})` return url } -module.exports.linkPill = function(url, content, tooltip = ""){ +module.exports.linkPill = function(url, content = "", tooltip = ""){ if(tooltip.length) tooltip = ` '${tooltip}'` - if(content) return `[**\` ${content.replace(/\`/g, 'ˋ')} \`**](${url}${tooltip})` + if(content) return `[**\` ${content.toString().replace(/\`/g, 'ˋ')} \`**](${url}${tooltip})` return url }