Skip to content

Conversation

@majiayu000
Copy link

Fixes #858

Changes

  • Make WithPreservedNewLines() conditional based on the --preserve-new-lines flag
  • Default behavior now correctly treats soft line breaks as spaces in lists

Previously, glamour.WithPreservedNewLines() was always applied, causing all line breaks (including soft breaks in lists) to be preserved. Now it respects the CLI flag.

CLI mode was unconditionally applying WithPreservedNewLines() which
caused line breaks to always be preserved regardless of the
--preserve-new-lines (-n) flag setting. This made CLI mode behave
differently from TUI mode where the flag is properly respected.

The fix makes CLI mode consistent with TUI mode by only applying
WithPreservedNewLines() when the preserveNewLines config option
is true.

Fixes charmbracelet#858

Signed-off-by: majiayu000 <[email protected]>
@majiayu000 majiayu000 requested a review from a team as a code owner January 1, 2026 17:10
@majiayu000 majiayu000 requested review from aymanbagabas and kujtimiihoxha and removed request for a team January 1, 2026 17:10
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.

Line breaks aren't properly ignored in lists

1 participant