mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 09:52:27 +00:00
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:
1 parent
22cab8215a
commit
e124bdfc54
5 files changed
+166
-30
No files matched your search
@@ -323,21 +323,36 @@ const escapeTableCell = (value: string): string =>
|
||||
(character) =>
|
||||
`\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`,
|
||||
)
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.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 "&";
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case ":":
|
||||
return ":";
|
||||
default:
|
||||
return ";";
|
||||
}
|
||||
})
|
||||
.replace(/([xXB8]-)\)/g, "$1)")
|
||||
.replace(/\r\n|\r|\n/g, "<br>");
|
||||
|
||||
const encodeMarkdownWhitespace = (whitespace: string): string =>
|
||||
whitespace.replace(/ /g, " ").replace(/\t/g, "	");
|
||||
|
||||
/** 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, " ").replace(/\t/g, "	"),
|
||||
);
|
||||
.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) =>
|
||||
" ".repeat(spaces.length),
|
||||
escapeTableCell(value).replace(/^[ \t]+|[ \t]+$/g, (spaces) =>
|
||||
encodeMarkdownWhitespace(spaces),
|
||||
);
|
||||
const escapedHeaders = headers.map(encodeTableCell);
|
||||
const widths = escapedHeaders.map((header) => header.length);
|
||||
|
||||
Reference in new issue
Block a user