Skip to content

Commit 9b75042

Browse files
committed
fix(word): keep stripping control characters before Markdown parsing
1 parent 5d3261f commit 9b75042

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/sim/lib/microsoft-word/document.server.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ function parseInlineRuns(line: string): ContentRun[] {
8383
function parseContentBlocks(content: string): ContentBlock[] {
8484
const blocks: ContentBlock[] = []
8585

86-
for (const rawLine of content.replace(/\r\n?/g, '\n').split('\n')) {
86+
// Stripped before the Markdown patterns run, so a stray control character
87+
// from an upstream block can't hide a heading or bullet marker. Tab, newline,
88+
// and carriage return are legal XML and outside the class, so the split below
89+
// is unaffected.
90+
for (const rawLine of stripInvalidXmlChars(content).replace(/\r\n?/g, '\n').split('\n')) {
8791
const line = rawLine.trimEnd()
8892
if (line.trim().length === 0) continue
8993

0 commit comments

Comments
 (0)