Skip to content

Commit e36e25a

Browse files
committed
view-autofixes: remove escape sequences as a workaround
1 parent 46de74c commit e36e25a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

extensions/ql-vscode/src/variant-analysis/view-autofixes.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,9 +1015,11 @@ async function formatWithMarkdown(
10151015
const backFormatting: string =
10161016
"```\n\n</details>\n\n ### Notes\n - notes placeholder\n\n";
10171017

1018-
// Format the content with Markdown
1019-
// Replace ``` in the content with \``` to avoid breaking the Markdown code block
1020-
const formattedContent = `## ${header}\n\n${frontFormatting}${content.replaceAll("```", "\\```")}${backFormatting}`;
1018+
// Format the content with Markdown:
1019+
// - Replace ``` in the content with \``` to avoid breaking the Markdown code block
1020+
// - Remove raw terminal escape sequences if any (workaround until `--diff-style plain` is handled by autofix)
1021+
// eslint-disable-next-line no-control-regex
1022+
const formattedContent = `## ${header}\n\n${frontFormatting}${content.replaceAll("```", "\\```").replaceAll(/\x1b\[[0-9;]*m/g, "")}${backFormatting}`;
10211023

10221024
// Write the formatted content back to the file
10231025
await writeFile(inputFile, formattedContent);

0 commit comments

Comments
 (0)