Merge pull request 'Fix code blocks not working in MFM' (#96) from sfr/pleroma-fe:fix/mfm into develop

Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/96
This commit is contained in:
floatingghost 2022-08-01 14:57:04 +00:00
commit 6f1bb99990

View file

@ -124,6 +124,14 @@ export default {
}
const renderMisskeyMarkdown = (content) => {
// Untangle code blocks from <br> tags
const codeblocks = content.match(/(<br\/>)?(~~~|```)\w*<br\/>.+?<br\/>\2\1?/g)
if (codeblocks) {
codeblocks.forEach((pre) => {
content = content.replace(pre, pre.replaceAll('<br/>', '\n'))
})
}
marked.use(markedMfm, {
mangle: false,
gfm: false,