fix: use global regex to escape backticks (#1253)

This commit is contained in:
Svyatoslav Kryukov 2023-01-17 14:26:36 +03:00 committed by GitHub
parent 8d3be0f3cf
commit 08eebb651d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,7 +89,7 @@ export function parseMastodonHTML(
const code = htmlToText(raw)
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/`/, '&#96;')
.replace(/`/g, '&#96;')
const classes = lang ? ` class="language-${lang}"` : ''
return `><pre><code${classes}>${code}</code></pre>`
})