fix markdown issue

This commit is contained in:
derpystuff 2023-08-27 13:52:18 +02:00
parent 9f18d4814f
commit 1362395228

View file

@ -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 `<t:${Math.floor(time/1000)}:${flag}>`
}
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
}