Skip to content

Commit

Permalink
fix(codeblock): When parsing markdown, there will be an extra line at…
Browse files Browse the repository at this point in the history
… the end
  • Loading branch information
big-camel committed Jun 15, 2022
1 parent 104eab5 commit 688514a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/codeblock-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ export default class<
false,
);
code = unescape(code.replace(/\u200b/g, ''));
if (code.endsWith('\n')) {
code = code.slice(0, -1);
}
editor.card.replaceNode<CodeBlockValue>(node, 'codeblock', {
mode: syntax || 'plain',
code,
Expand Down
3 changes: 3 additions & 0 deletions plugins/codeblock/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ export default class<
false,
);
code = unescape(code.replace(/\u200b/g, ''));
if (code.endsWith('\n')) {
code = code.slice(0, -1);
}
editor.card.replaceNode<CodeBlockValue>(node, 'codeblock', {
mode: syntax || 'plain',
code,
Expand Down

0 comments on commit 688514a

Please sign in to comment.