forked from srxl/akkoma-fe
Merge pull request 'Decode html-encoded characters inside pre tags' (#101) from sfr/pleroma-fe:mfm-htmlencode into develop
Reviewed-on: AkkomaGang/pleroma-fe#101
This commit is contained in:
commit
9421aa1d39
1 changed files with 9 additions and 2 deletions
|
@ -124,11 +124,18 @@ export default {
|
|||
}
|
||||
|
||||
const renderMisskeyMarkdown = (content) => {
|
||||
// Untangle code blocks from <br> tags
|
||||
// Untangle code blocks from <br> tags and other html encodings
|
||||
const codeblocks = content.match(/(<br\/>)?(~~~|```)\w*<br\/>.+?<br\/>\2\1?/g)
|
||||
if (codeblocks) {
|
||||
codeblocks.forEach((pre) => {
|
||||
content = content.replace(pre, pre.replaceAll('<br/>', '\n'))
|
||||
content = content.replace(pre,
|
||||
pre.replaceAll('<br/>', '\n')
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue