Defect #22323
closedMarkdown newline rendering broken
0%
Description
As per the specs Markdown should not insert <br /> for single line breaks. <br /> should only occur for:
- A line ending with 2 or more spaces, then a line break.
- One or more blank lines between paragraphs lines. In other words, 2 or more line breaks.
GitHub is consistent with this in wiki formatting. In GitHub issues a single line break also triggers a rendered line break, the reason for this is beyond me but that's also against the specs.
Please fix this. This actually breaks Pandoc conversion from Textile pages because Pandoc occasionally inserts line breaks even within paragraphs and this causes line breaks in the rendered text as well thus breaking the format.
Files
Related issues
Updated by Viktor Berke over 8 years ago
Since I can't add related issues, I'll just link it: Rake task for converting from Textile to Markdown
Updated by Go MAEDA over 8 years ago
- Category changed from Wiki to Text formatting
Updated by Toshi MARUYAMA over 8 years ago
- Related to Feature #22005: Rake task for converting from Textile to Markdown added
Updated by Pablo Yanez Trujillo over 5 years ago
I'd like to know whether this has been fixed in the current 4.x releases. I still have an 3.3.7 installation and this is annoying, specially since I use text-aid-too (https://github.com/smblott-github/text-aid-too) to edit content with vim and I have line wrapping at 80 characters. When editing on github, or stackooverflow then there is no problem. But on my redmine pages, it's a problem, because redmine inserts <br /> where it shouldn't.
Updated by Martin Cizek almost 5 years ago
- File 22323-with-test.patch 22323-with-test.patch added
On one hand, calling this a defect might not be fair, as it is apparently kind-of decision made in lib/redmine/wiki_formatting/markdown/formatter.rb
with the setting :hard_wrap => true
. Indeed, we do not know how intentional the decision was.
On the other hand, it breaks compatibility with GFM, especially on its two major implementations GitHub and GitLab (as said - except GitHub issues, but our developers are really angry about GitHub issues having different behaviour than the rest of GitHub). And as the author says, it is against Markdown specs.
I guess we are not that rare when we intend to share Markdown sources between Redmine and GitLab and among Redmine and other systems - using API, mirroring wiki to git and indeed with users' copy&pasting it.
So I would strongly vote to change the default behavior towards more standard Markdown / GFM to stay compatible with the world.
The patch is included including a unit test. :) P.S. The tests at the end of MarkdownFormatterTest
seem to be commented out by private
? Not sure why, but the tests work even after commenting it out to #private
.
Updated by Mischa The Evil almost 5 years ago
Martin Cizek wrote:
P.S. The tests at the end of
MarkdownFormatterTest
seem to be commented out byprivate
? Not sure why, but the tests work even after commenting it out to#private
.
I have reported this in a separate issue, #31929. Thanks for mentioning it here.
Updated by Martin Cizek almost 5 years ago
Updated by Go MAEDA almost 5 years ago
- Target version set to Candidate for next major release
Updated by Martin Cizek over 4 years ago
Target version set to Candidate for next major release
Now, when there is #32424, I'd vote for keeping the markdown format as is and deprecate it. This would be actually a cleaner solution for users who rely on its current behavior, which includes hard line breaks.
Updated by Mischa The Evil about 4 years ago
- Related to Feature #32424: CommonMark Markdown Text Formatting added
Updated by Marius BĂLTEANU about 3 years ago
- Related to deleted (Feature #32424: CommonMark Markdown Text Formatting)
Updated by Marius BĂLTEANU about 3 years ago
- Is duplicate of Feature #32424: CommonMark Markdown Text Formatting added
Updated by Marius BĂLTEANU about 3 years ago
- Status changed from New to Closed
- Target version deleted (
Candidate for next major release) - Resolution set to Duplicate
The current Markdown implementation based on RedCarpet is deprecated and it is going to be dropped in the future versions and it will be replaced by the CommonMark Markdown (Github Flavoured) formatter that was just committed for 5.0.0.
Hardbreaks behaviour will be configurable at instance level, please follow the discussions from #32424.