Skip to content

Enable break_on_newline extension by default for Markdown#1628

Open
st0012 wants to merge 1 commit intomasterfrom
enable-break-on-newline
Open

Enable break_on_newline extension by default for Markdown#1628
st0012 wants to merge 1 commit intomasterfrom
enable-break-on-newline

Conversation

@st0012
Copy link
Member

@st0012 st0012 commented Mar 1, 2026

Summary

  • Enable the existing break_on_newline extension in DEFAULT_EXTENSIONS so the Markdown parser converts soft line breaks to HardBreak objects at parse time
  • This produces visible <br> line breaks in HTML output, matching GFM rendering where > Foo\nbar shows "Foo" and "bar" on separate lines
  • The conversion happens in the Markdown parser's paragraph() method, which is the proper place for Markdown-specific behavior — no changes to the generic accept_paragraph in ToHtml
  • Also removes the CJK-aware newline-to-space gsub from accept_paragraph that is no longer needed (the RDoc markup parser already handles newline joining at parse time in build_paragraph)

Ref: #1550 (comment)

Enable the existing break_on_newline extension in DEFAULT_EXTENSIONS so
the Markdown parser converts soft line breaks to HardBreak objects. This
produces visible <br> line breaks in HTML output, matching GFM rendering.

The conversion happens in the Markdown parser's paragraph() method,
which is the proper place for Markdown-specific behavior. The generic
accept_paragraph in ToHtml is unchanged and has no Markdown-specific
logic.

Also remove the CJK-aware newline-to-space gsub from accept_paragraph
that is no longer needed. The RDoc markup parser already handles newline
joining at parse time in build_paragraph.
@matzbot
Copy link
Collaborator

matzbot commented Mar 1, 2026

🚀 Preview deployment available at: https://b6667172.rdoc-6cd.pages.dev (commit: 2482465)

@st0012 st0012 added the bug label Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants