Keep a code block's leading newline when linking a message's text

A <pre> whose text starts with a newline needs one more written out to
survive being parsed again, as the html5 serializer does with
preserve_newline. Without it, linking text dropped one more of a code
block's leading blank lines than rendering did before.
This commit is contained in:
Jeremy Daer committed 2026-10-15 18:42:06 -07:00
1 parent 6052b123d5
commit 4e29c6e32b
2 files changed
+8 -1

No files matched your search

+2 -1
View File
@@ -130,7 +130,8 @@ module MessagesHelper
end
end
fragment.to_html.html_safe
# A <pre> starting with a newline needs an extra one written out to survive the next parse
fragment.to_html(preserve_newline: true).html_safe
end
def messages_actions