Skip to content

Commit aeceb23

Browse files
reggiCopilot
andauthored
chore: sanitize newlines in flags table default and type values (#9407)
Backport of #9393 to release/v11. The `generateFlagsTable` function in `docs/lib/index.js` sanitizes `description` for newlines but not `defaultVal` or `typeVal`. Multi-line `defaultDescription` values (like `--access`) break the markdown table rendering. Adds `.replace(/\n/g, ' ').trim()` to both `defaultVal` and `typeVal`, matching the existing sanitization on `desc`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cde03ba commit aeceb23

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

docs/lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,12 @@ const generateFlagsTable = (definitionPool) => {
151151
if (!defaultVal) {
152152
defaultVal = String(def.default)
153153
}
154+
defaultVal = defaultVal.replace(/\n/g, ' ').trim()
154155
let typeVal = def.typeDescription || String(def.type)
155156
if (def.required) {
156157
typeVal = `${typeVal} (required)`
157158
}
159+
typeVal = typeVal.replace(/\n/g, ' ').trim()
158160
const desc = (def.description || '').replace(/\n/g, ' ').trim()
159161
return `| ${flagsStr} | ${defaultVal} | ${typeVal} | ${desc} |`
160162
})

0 commit comments

Comments
 (0)