Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markdown_github line break behavior #3594

Closed
rmwiseman opened this issue Apr 20, 2017 · 7 comments
Closed

markdown_github line break behavior #3594

rmwiseman opened this issue Apr 20, 2017 · 7 comments

Comments

@rmwiseman
Copy link

All that this Github help page says about paragraphs and line breaks is:

You can create a new paragraph by leaving a blank line between lines of text.

Because this doesn't override the standard markdown behaviour for paragraphs and line breaks, it's reasonable to assume it will behave in the same way as standard markdown.

However:

echo -e "abc\ndef" | pandoc -f markdown_github

results in:

<p>abc<br />
def</p>

but should, like with markdown_strict, result in:

<p>abc def</p>
@mb21
Copy link
Collaborator

mb21 commented Apr 20, 2017

it's reasonable to assume it will behave in the same way as standard markdown.

maybe it would be reasonable, but it is not so. e.g.:

abc
def

renders here on GitHub as:

abc
def

Please also consider asking questions like this on pandoc-discuss, the issue tracker is for bugs.

@mb21 mb21 closed this as completed Apr 20, 2017
@rmwiseman
Copy link
Author

Sorry, I didn't follow that. When you say "it's not so" what are you basing that on? The behaviour of pandoc? On Github itself,

abc
def

is rendered just as I said it should be:

abc def

That indicates that this is a bug on pandoc. Have I missed something?!

@mb21
Copy link
Collaborator

mb21 commented Apr 20, 2017

is rendered just as I said it should be:

@rmwiseman are you sure? I just tried in my comment above and it was split into two lines... is the behaviour different in READMEs?

@rmwiseman
Copy link
Author

rmwiseman commented Apr 20, 2017

I was sure! :-D

I just created a new test project and this is the contents of my README.md file:

# test
Just a test project

abc
def

Here's a screen grab of how it appears on github:

readme md

@mb21
Copy link
Collaborator

mb21 commented Apr 20, 2017

Ah, this probably has to do with https://githubengineering.com/a-formal-spec-for-github-markdown/

@jgm Maybe there should be a new extension flag? e.g. markdown_github_commonmark

@mb21 mb21 reopened this Apr 20, 2017
@tarleb
Copy link
Collaborator

tarleb commented Apr 20, 2017

Related stackoverflow question: http://stackoverflow.com/questions/24575680/new-lines-inside-paragraph-in-readme-md

The non-linebreaking behavior can be forced by using markdown_github-hard_line_breaks.

@jgm
Copy link
Owner

jgm commented Apr 21, 2017

You're both right. GitHub has two Markdown modes, one for long-form documents like READMEs and one for short things like issue coments. In issue comments, a line break is treated as a hard line break. In README, wikis, etc., it is treated as a space as in regular Markdown.

People often get confused by this. [And it has nothing to do with CommonMark; now that GitHub is using CommonMark, they're still locally adding the hard line breaks extension in issue comments.]

We had to choose one for the default in markdown_github, so we chose +hard_line_breaks, but perhaps that is not the best decision, since pandoc is probably most often used for long-form documents. I'd be open to changing this.

@jgm jgm changed the title markdown_github doesn't treat line breaks properly Change markdown_github so it doesn't include hard_line_breaks by default? Apr 21, 2017
@jgm jgm changed the title Change markdown_github so it doesn't include hard_line_breaks by default? markdown_github line break behavior Apr 21, 2017
@jgm jgm closed this as completed in d3dae12 Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants