Skip to content

fix: keep Markdown line breaks consistent with preview - #25

Open
stevenjoezhang wants to merge 1 commit into
anghunk:mainfrom
stevenjoezhang:agent/fix-markdown-line-breaks
Open

fix: keep Markdown line breaks consistent with preview#25
stevenjoezhang wants to merge 1 commit into
anghunk:mainfrom
stevenjoezhang:agent/fix-markdown-line-breaks

Conversation

@stevenjoezhang

Copy link
Copy Markdown

Summary

  • centralize the backend marked options used for comment creation and admin edits
  • enable gfm: true and breaks: true to match the widget preview
  • add a regression test for single-newline rendering

Root cause

The widget preview enables breaks: true, but the backend previously called marked.parse() without that option. A single newline therefore appeared as a line break in preview but was collapsed to whitespace after the comment was saved or edited.

Impact

New and edited comments now preserve single newlines consistently with the preview. The API schema and XSS sanitization behavior are unchanged. This patch does not migrate existing comment records.

Validation

  • ./node_modules/.bin/vitest --run (4 files, 11 tests passed)
  • git diff --check

tsc --noEmit still reports the repository's existing errors in telegramSettings.ts and the existing xss.whiteList typings in the two comment handlers; this patch introduces no additional type errors.

@stevenjoezhang
stevenjoezhang marked this pull request as ready for review July 29, 2026 17:27
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