fix(cli): preserve literal Markdown rendering (#7938)

* fix(cli): preserve literal Markdown rendering

* fix(cli): retain literal Markdown attributes

* fix(cli): preserve literal punctuation in markdown

* test(cli): update escaped empty object expectations

* style(cli): format the literal empty-object Markdown expectation

* test(mcp): assert bundle path issues by field

compare_bundles reports each relative path as an invalid_format issue
instead of one joined diagnostic sentence.

* test(flutter): assert ABI selector refusals as structured issues

inspect_dart_aot reports the ABI label as an issue on path abi. The
message is the selector contract, without an abi: prefix.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
morlutoandCursor Agent authored and GitHub committed 2026-10-29 20:07:17 +08:00
1 parent 22cab8215a
commit e124bdfc54
5 files changed
+166 -30

No files matched your search

+25 -10
View File
@@ -323,21 +323,36 @@ const escapeTableCell = (value: string): string =>
(character) =>
`\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`,
)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/[\\|`*[\]~]|_+/g, escapeInlineSyntax)
.replace(/[\\|`*[\]~{}#]|_+/g, escapeInlineSyntax)
// Encode renderer-extension introducers at the same boundary as HTML
// characters. Generated entities must not themselves be re-escaped.
.replace(/[&<>:]|;(?=-?[)(])/g, (character) => {
switch (character) {
case "&":
return "&amp;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case ":":
return "&#58;";
default:
return "&#59;";
}
})
.replace(/([xXB8]-)\)/g, "$1&#41;")
.replace(/\r\n|\r|\n/g, "<br>");
const encodeMarkdownWhitespace = (whitespace: string): string =>
whitespace.replace(/ /g, "&#32;").replace(/\t/g, "&#9;");
/** Heading and paragraph facts are literal data, including block syntax. */
const escapeMarkdownText = (value: string): string =>
escapeTableCell(value)
.replace(/#/g, "\\#")
.replace(/^(\s*)([-+=])/, "$1\\$2")
.replace(/^(\s*\d{1,9})([.)])(?=\s)/, "$1\\$2")
.replace(/^[ \t]+/, (indent) =>
indent.replace(/ /g, "&#32;").replace(/\t/g, "&#9;"),
);
.replace(/^[ \t]+/, encodeMarkdownWhitespace)
.replace(/[ \t]+$/u, encodeMarkdownWhitespace);
const markdownHeading = (path: readonly string[]): string =>
`## ${escapeMarkdownText(path.join("."))}\n\n`;
@@ -348,8 +363,8 @@ const renderTable = (
): string => {
if (headers.length === 0) return "";
const encodeTableCell = (value: string): string =>
escapeTableCell(value).replace(/^ +| +$/g, (spaces) =>
"&#32;".repeat(spaces.length),
escapeTableCell(value).replace(/^[ \t]+|[ \t]+$/g, (spaces) =>
encodeMarkdownWhitespace(spaces),
);
const escapedHeaders = headers.map(encodeTableCell);
const widths = escapedHeaders.map((header) => header.length);