Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Disable hard wrapping in GFM #2864

Closed
wants to merge 1 commit into from

6 participants

@titanous

This is a follow-up to #2818 that disables the hard wrapping entirely with no config option.

@2called-chaos

I don't think this is gonna be merged. I think most people are happy with hard_wrap and also is it compliant to Github's parsing (well beside from HTML for some reason). Also this will break existing files and comments. Especially the latter is a part where I would expect hard wrapping.

Did you thought about maintaining a personal branch where you can cherry pick and manage your own personal changes (I removed the HTML restriction for example).

Github doesn't use hard wrap.

@mikkyhouse

we keep current implementation for compatibility. thank you

@mikkyhouse mikkyhouse closed this
@cdbennett

@titanous Perfect, this is awesome. Creating paragraph breaks from newlines is totally wrong, especially for Git commit messages which should be hard wrapped at 72 columns, but you would want this reflowed by a rendered rich text view.

@joshuaspence

This change should be merged. Writing a paragraph on a single line is painful and forcing a paragraph break at newline is just wrong. GitHub does not treat newlines in this way.

@cdbennett

What if someone makes a pull request that adds a config option to make the GitLab-flavor the default but the user can opt-in to the standard markdown line break treatment by setting a config file option? Perhaps that will be acceptable since it won't break backward compatibility.

@nat-n

Having to either write crazy long lines of text (or worse turn on wrapping in a text editor), or have non-sensical paragraph structure in markdown files is ridiculous.

Having at least a "sane documentation option" would be quite useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 31, 2013
  1. @titanous

    Disable hard wrapping in GFM

    titanous authored
This page is out of date. Refresh to see the latest.
View
3  app/helpers/gitlab_markdown_helper.rb
@@ -33,8 +33,7 @@ def markdown(text)
gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self,
# see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch-
filter_html: true,
- with_toc_data: true,
- hard_wrap: true)
+ with_toc_data: true)
@markdown = Redcarpet::Markdown.new(gitlab_renderer,
# see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
no_intra_emphasis: true,
View
13 app/views/help/markdown.html.haml
@@ -29,19 +29,6 @@
.span8
%h3 Differences from traditional Markdown
- %h4 Newlines
-
- %p
- The biggest difference that GFM introduces is in the handling of linebreaks.
- With traditional Markdown you can hard wrap paragraphs of text and they will be combined into a single paragraph. We find this to be the cause of a huge number of unintentional formatting errors.
- GFM treats newlines in paragraph-like content as real line breaks, which is probably what you intended.
-
-
- %p The next paragraph contains two phrases separated by a single newline character:
- %pre= "Roses are red\nViolets are blue"
- %p becomes
- = markdown "Roses are red\nViolets are blue"
-
%h4 Multiple underscores in words
%p
Something went wrong with that request. Please try again.