feat(docs): Ensure multiline JS objects are rendered properly. (#13535)

This commit is contained in:
joshualitt
2025-11-21 09:59:34 -08:00
committed by GitHub
parent 99c5bf2e97
commit 0713c86dec
5 changed files with 259 additions and 8 deletions

View File

@@ -168,7 +168,23 @@ function renderSections(sections: Map<string, DocEntry[]>) {
for (const entry of entries) {
lines.push(`- **\`${entry.path}\`** (${entry.type}):`);
lines.push(` - **Description:** ${entry.description}`);
lines.push(` - **Default:** \`${escapeBackticks(entry.defaultValue)}\``);
if (entry.defaultValue.includes('\n')) {
lines.push(' - **Default:**');
lines.push('');
lines.push(' ```json');
lines.push(
entry.defaultValue
.split('\n')
.map((line) => ` ${line}`)
.join('\n'),
);
lines.push(' ```');
} else {
lines.push(
` - **Default:** \`${escapeBackticks(entry.defaultValue)}\``,
);
}
if (entry.enumValues && entry.enumValues.length > 0) {
const values = entry.enumValues