Markdown: wrapping an inline HTML comment splits its paragraph
Author: torjan0Created Sep 13, 2026Updated Sep 15, 2026
Prettier 3.9.6
--parser markdown
--prose-wrap always
--print-width 20
Input:
alpha <!-- retained comment --> beta
Output:
alpha
<!-- retained comment -->
beta
Expected output:
alpha <!-- retained comment --> beta
Why?
Wrapping may vary, but this should remain one paragraph. Moving <!-- to the start of a line creates a CommonMark HTML block, leaving alpha and beta in separate paragraphs. proseWrap: preserve and width 120 preserve the original structure.
Also reproduced on development commit 891accaaab6dab0fbb5eba6748fbb1f5ac4809b5. Related #19510 concerns comments already on separate lines in lists.
GPT-6 Astra assisted; I manually reviewed this report.
Source: prettier/prettier