fix: Pipe characters in code marks within tables cause the table layout to break
closes #4783
This commit is contained in:
@@ -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
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user