From 4faa83436ce9b9c766a0dc6f01afee5740496c17 Mon Sep 17 00:00:00 2001 From: "guojun.john" Date: Thu, 31 Dec 2020 15:34:39 +0800 Subject: [PATCH] Add \n before fence chars at the end of a code block. Otherwise the markdown editor cannot detect the end of a code block correclty. --- packages/turndown/src/plugins/juejinCodeBlock.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/turndown/src/plugins/juejinCodeBlock.ts b/packages/turndown/src/plugins/juejinCodeBlock.ts index ba71f13..6f99c61 100644 --- a/packages/turndown/src/plugins/juejinCodeBlock.ts +++ b/packages/turndown/src/plugins/juejinCodeBlock.ts @@ -26,7 +26,7 @@ export default function (turndownService: TurndownService) { return content; } node.querySelector('.copy-code-btn')?.remove(); - return `\`\`\`${(node.firstChild as HTMLElement)?.getAttribute('lang')}\n${node.firstChild?.textContent}\`\`\`\n\n`; + return `\`\`\`${(node.firstChild as HTMLElement)?.getAttribute('lang')}\n${node.firstChild?.textContent}\n\`\`\`\n\n`; }, }); }