escape ` in highlights

This commit is contained in:
derpystuff 2023-08-21 23:43:41 +02:00
parent 8d795cf919
commit e37e086f77

View file

@ -6,7 +6,7 @@ module.exports.icon = function(icon){
}
module.exports.highlight = function(content){
return "`" + content + "`"
return "`" + content.replace(/`/g, 'ˋ') + "`"
}
module.exports.codeblock = function(type, content){
@ -25,32 +25,32 @@ module.exports.timestamp = function(time, flag = "t"){
}
module.exports.pill = function(content){
return " **` " + content + " `**"
return " **` " + content.replace(/`/g, 'ˋ') + " `**"
}
module.exports.smallPill = function(content){
return " ` " + content + " `"
return " ` " + content.replace(/`/g, 'ˋ') + " `"
}
module.exports.iconPill = function(icon, content){
if(!REDESIGN_ICONS[icon]) icon = "question"
return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " **` " + content + " `**"
return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " **` " + content.replace(/`/g, 'ˋ') + " `**"
}
module.exports.smallIconPill = function(icon, content){
if(!REDESIGN_ICONS[icon]) icon = "question"
return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " ` " + content + " `"
return REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:') + " ` " + content.replace(/`/g, 'ˋ') + " `"
}
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} \`**](${url}${tooltip})`
if(content) return `${REDESIGN_ICONS[icon].replace(/:[a-z1-9_]*:/, ':i:')} [**\` ${content.replace(/`/g, 'ˋ')} \`**](${url}${tooltip})`
return url
}
module.exports.linkPill = function(url, content, tooltip = ""){
if(tooltip.length) tooltip = ` '${tooltip}'`
if(content) return `[**\` ${content} \`**](${url}${tooltip})`
if(content) return `[**\` ${content.replace(/`/g, 'ˋ')} \`**](${url}${tooltip})`
return url
}