Project

General

Profile

Actions

Defect #22323

closed

Markdown newline rendering broken

Added by Viktor Berke over 8 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

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

22323-with-test.patch (1.47 KB) 22323-with-test.patch Martin Cizek, 2019-08-20 16:28
22323-with-test-after-r18381.patch (1.48 KB) 22323-with-test-after-r18381.patch Martin Cizek, 2019-08-22 15:02

Related issues

Related to Redmine - Feature #22005: Rake task for converting from Textile to MarkdownNew

Actions
Is duplicate of Redmine - Feature #32424: CommonMark Markdown Text FormattingClosedMarius BĂLTEANU

Actions
Actions #1

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

Actions #2

Updated by Go MAEDA over 8 years ago

  • Category changed from Wiki to Text formatting
Actions #3

Updated by Toshi MARUYAMA over 8 years ago

  • Related to Feature #22005: Rake task for converting from Textile to Markdown added
Actions #4

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.

Actions #5

Updated by Martin Cizek over 5 years ago

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.

Actions #6

Updated by Mischa The Evil over 5 years ago

Martin Cizek wrote:

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.

I have reported this in a separate issue, #31929. Thanks for mentioning it here.

Actions #7

Updated by Martin Cizek about 5 years ago

Mischa The Evil wrote:

I have reported this in a separate issue, #31929. Thanks for mentioning it here.

You're very welcome. Attaching the patch updated against trunk (r18381).

Actions #8

Updated by Go MAEDA about 5 years ago

  • Target version set to Candidate for next major release
Actions #9

Updated by Martin Cizek almost 5 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.

Actions #10

Updated by Mischa The Evil over 4 years ago

  • Related to Feature #32424: CommonMark Markdown Text Formatting added
Actions #11

Updated by Marius BĂLTEANU over 3 years ago

  • Related to deleted (Feature #32424: CommonMark Markdown Text Formatting)
Actions #12

Updated by Marius BĂLTEANU over 3 years ago

  • Is duplicate of Feature #32424: CommonMark Markdown Text Formatting added
Actions #13

Updated by Marius BĂLTEANU over 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.

Actions

Also available in: Atom PDF