google knowledge graph

This commit is contained in:
derpystuff 2023-03-02 17:35:38 +01:00
parent f9dfc8fc93
commit cb83cc9c5d
2 changed files with 44 additions and 14 deletions

View file

@ -34,4 +34,15 @@ module.exports.smallPill = function(content){
module.exports.iconPill = function(icon, content){
if(!ICONS[icon]) icon = "question"
return ICONS[icon] + " **` " + content + " `**"
}
const SUPERSCRIPT_NUMBERS = ["⁰","¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹"]
module.exports.citation = function(number = 1, url, tooltip = ""){
let formatted = "";
for(const n of number.toString().split('')) formatted += SUPERSCRIPT_NUMBERS[parseInt(n)]
if(url){
if(tooltip.length) tooltip = ` '${tooltip}'`
return `[⁽${formatted}⁾](${url}${tooltip})`
}
return `${formatted}`
}