Fix code blocks not working in MFM
This commit is contained in:
parent
7c675f1ded
commit
b69801d33f
1 changed files with 8 additions and 0 deletions
|
@ -124,6 +124,14 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderMisskeyMarkdown = (content) => {
|
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, {
|
marked.use(markedMfm, {
|
||||||
mangle: false,
|
mangle: false,
|
||||||
gfm: false,
|
gfm: false,
|
||||||
|
|
Loading…
Reference in a new issue