Skip to content

Commit

Permalink
fix: disable escaping when serializing content for code_block (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m1d0v authored Dec 24, 2024
1 parent c24f2e0 commit 617a1cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/markdown/MarkdownSerializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/markdown/CodeBlock/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)!,
Expand Down

0 comments on commit 617a1cc

Please sign in to comment.