Skip to content

Commit 617a1cc

Browse files
authored
fix: disable escaping when serializing content for code_block (#537)
1 parent c24f2e0 commit 617a1cc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/core/markdown/MarkdownSerializer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class MarkdownSerializerState {
165165
const startOfLine = this.atBlank() || this.closed;
166166
this.write();
167167
let text = lines[i];
168-
if (escape !== false) text = this.esc(text, startOfLine)
168+
if (escape !== false && this.options.escape !== false) text = this.esc(text, startOfLine)
169169
if (this.escapeWhitespace) text = this.escWhitespace(text);
170170
this.out += text
171171
if (i != lines.length - 1) this.out += '\n';

src/extensions/markdown/CodeBlock/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const setCodeBlockType =
2828
if (!setBlockType(nodeType)(state)) return false;
2929

3030
if (dispatch) {
31-
const markup = serializer.serialize(state.selection.content().content);
31+
const markup = serializer.serialize(state.selection.content().content, {escape: false});
3232
dispatch(
3333
state.tr.replaceSelectionWith(
3434
nodeType.createAndFill({}, markup ? state.schema.text(markup) : null)!,

0 commit comments

Comments
 (0)