i18n
i18n copied to clipboard
fix: shouldn't htmlEntities and htmlNumbers pass ?
Just by chance I looked at this pr when was opened
and I asked myself whether or not the escapeHtml should ignore htmlEntities and htmlNumbers
this would mean no transformation for those occurrences when using markdown: true, which makes a lot of sense to my eyes
in case it actually should behave like that, this pr fixes it accordingly, changing the bare minimum. actually that function could also be reduced to
export function escapeHtml(unsafe = ''){
const htmlEscapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
}
const rxt = /&(?![\w\#]+;)|[<>"']/g
const rx = new RegExp(rxt);
return rx.test(unsafe)
? unsafe.replace(rxt, e => htmlEscapes[e])
: unsafe
}
please let me know your thoughts on that
@signavio-fghedina is this PR still valid and needed or may it be closed?
@signavio-fghedina is this PR still valid and needed or may it be closed?
@marpme I think it is still valid implementation wise. Up to you, I wont mind if u close it 🤷♂️