Skip to content

fix(docs): sanitize newlines in flags table default and type values#9393

Open
reggi wants to merge 1 commit into
latestfrom
reggi/fix-docs-table-newlines
Open

fix(docs): sanitize newlines in flags table default and type values#9393
reggi wants to merge 1 commit into
latestfrom
reggi/fix-docs-table-newlines

Conversation

@reggi
Copy link
Copy Markdown
Contributor

@reggi reggi commented May 22, 2026

Problem

The generateFlagsTable function in docs/lib/index.js sanitizes description for newlines but does not do the same for defaultVal or typeVal. Some config definitions (like --access) have multi-line defaultDescription values, which breaks the markdown table — all subsequent columns/rows get collapsed into a single garbled line.

This is visible on the live docs: https://docs.npmjs.com/cli/v11/commands/npm-stage

Fix

Added .replace(/\n/g, ' ').trim() to both defaultVal and typeVal in generateFlagsTable, matching the existing sanitization already applied to desc.

The generateFlagsTable function was not stripping newlines from
defaultVal and typeVal, causing multi-line values (like --access's
defaultDescription) to break markdown table rows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reggi reggi requested review from a team as code owners May 22, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant