fix: Pipe characters in code marks within tables cause the table layout to break

closes #4783
This commit is contained in:
Tom Moor
2023-01-28 13:01:02 -05:00
parent 7dbc419bbf
commit aac495fa58

View File

@@ -296,12 +296,16 @@ export class MarkdownSerializerState {
this.text(this.markString(add, true, parent, index), false); this.text(this.markString(add, true, parent, index), false);
} }
// Render the node. Special case code marks, since their content // Render the node. Special case code marks, since their content is not
// may not be escaped. // escaped, apart from pipes in tables.
if (noEsc && node.isText) { if (noEsc && node.isText) {
const text = this.inTable
? node.text.replace(/\|/gi, "\\$&")
: node.text;
this.text( this.text(
this.markString(inner, true, parent, index) + this.markString(inner, true, parent, index) +
node.text + text +
this.markString(inner, false, parent, index + 1), this.markString(inner, false, parent, index + 1),
false false
); );