diff --git a/src/core/markdown/MarkdownSerializer.js b/src/core/markdown/MarkdownSerializer.js index c4762b61..d9926549 100644 --- a/src/core/markdown/MarkdownSerializer.js +++ b/src/core/markdown/MarkdownSerializer.js @@ -165,7 +165,7 @@ export class MarkdownSerializerState { const startOfLine = this.atBlank() || this.closed; this.write(); let text = lines[i]; - if (escape !== false) text = this.esc(text, startOfLine) + if (escape !== false && this.options.escape !== false) text = this.esc(text, startOfLine) if (this.escapeWhitespace) text = this.escWhitespace(text); this.out += text if (i != lines.length - 1) this.out += '\n'; diff --git a/src/extensions/markdown/CodeBlock/commands.ts b/src/extensions/markdown/CodeBlock/commands.ts index ce9696ef..7ed1ce0d 100644 --- a/src/extensions/markdown/CodeBlock/commands.ts +++ b/src/extensions/markdown/CodeBlock/commands.ts @@ -28,7 +28,7 @@ export const setCodeBlockType = if (!setBlockType(nodeType)(state)) return false; if (dispatch) { - const markup = serializer.serialize(state.selection.content().content); + const markup = serializer.serialize(state.selection.content().content, {escape: false}); dispatch( state.tr.replaceSelectionWith( nodeType.createAndFill({}, markup ? state.schema.text(markup) : null)!,