Skip to content

fix: preserve jsdoc markdown hard breaks#800

Open
jmolz wants to merge 1 commit into
dprint:mainfrom
jmolz:fix-jsdoc-markdown-hard-breaks
Open

fix: preserve jsdoc markdown hard breaks#800
jmolz wants to merge 1 commit into
dprint:mainfrom
jmolz:fix-jsdoc-markdown-hard-breaks

Conversation

@jmolz
Copy link
Copy Markdown

@jmolz jmolz commented Jun 6, 2026

Refs denoland/deno#31831.

JSDoc is commonly rendered as Markdown, but the TypeScript formatter currently trims two trailing spaces from non-final JSDoc lines. That removes Markdown hard line breaks. The Markdown plugin normalizes the same input to a backslash hard break, so this applies the same normalization to JSDoc lines while keeping non-JSDoc block comments on the existing trimming behavior.

The regression coverage also guards the main edge cases from the narrower behavior:

  • converts a JSDoc Markdown hard break when another content line follows
  • does not convert a hard break on the last meaningful JSDoc content line
  • does not convert trailing spaces inside a fenced JSDoc code block
  • does not convert hard breaks in non-JSDoc block comments

Tests:

  • cargo test --test specs issue031831
  • cargo test --test specs JSDocComments_All
  • cargo test --test specs CommentBlocks_All
  • cargo test

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