Fix code blocks not working in MFM

This commit is contained in:
Sol Fisher Romanoff 2022-08-01 16:13:14 +03:00
parent 7c675f1ded
commit b69801d33f
No known key found for this signature in database
GPG key ID: 9D3F2B64F2341B62

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,