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

Allow simple linebreaks. #164

Closed
rubenarslan opened this issue Jul 10, 2014 · 11 comments

Comments

@rubenarslan
Copy link

commented Jul 10, 2014

I'm using Parsedown to generate non-dynamic HTML from markdown, and knitr/rmarkdown to generate dynamic HTML from rmd.

Parsedown has the Option setBreaksEnabled, where like here on Git
hub you can get a linebreak without ending the line with two spaces.

I always thought this was the only sane way to do it. According to this spec you also want to support GH-flavoured Markdown, but maybe that's out of date?

@jjallaire

This comment has been minimized.

Copy link
Member

commented Jul 10, 2014

Yes, that's the older version of R Markdown (which BTW also had the same
line breaking behavior, that was one place we differed from GitHub flavored
markdown. The big reason we do this is for compatibility with pandoc,
which has become the defacto standard for markdown in technical/academic
communities.

On Thu, Jul 10, 2014 at 1:27 PM, Ruben C. Arslan notifications@github.com
wrote:

I'm using Parsedown http://parsedown.org/ to generate non-dynamic HTML
from markdown, and knitr/rmarkdown to generate dynamic HTML from rmd.

Parsedown has the Option setBreaksEnabled, where like here on Git
hub you can get a linebreak without ending the line with two spaces.

I always thought this was the only sane way to do it. According to this
spec https://support.rstudio.com/hc/en-us/articles/200488468-R-Markdown
you also want to support GH-flavoured Markdown, but maybe that's out of
date?


Reply to this email directly or view it on GitHub
#164.

@rubenarslan

This comment has been minimized.

Copy link
Author

commented Jul 10, 2014

Could you at least make proper line breaks an opt-in?
All of my academic colleagues are non-technical. They can use Markdown,
but not yet pandoc and they don't understand invisible characters at the end
of a line being important. Neither do I.
On 10 Jul 2014, at 21:12, JJ Allaire notifications@github.com wrote:

Yes, that's the older version of R Markdown (which BTW also had the same
line breaking behavior, that was one place we differed from GitHub flavored
markdown. The big reason we do this is for compatibility with pandoc,
which has become the defacto standard for markdown in technical/academic
communities.

On Thu, Jul 10, 2014 at 1:27 PM, Ruben C. Arslan notifications@github.com
wrote:

I'm using Parsedown http://parsedown.org/ to generate non-dynamic HTML
from markdown, and knitr/rmarkdown to generate dynamic HTML from rmd.

Parsedown has the Option setBreaksEnabled, where like here on Git
hub you can get a linebreak without ending the line with two spaces.

I always thought this was the only sane way to do it. According to this
spec https://support.rstudio.com/hc/en-us/articles/200488468-R-Markdown
you also want to support GH-flavoured Markdown, but maybe that's out of
date?


Reply to this email directly or view it on GitHub
#164.


Reply to this email directly or view it on GitHub.

@jjallaire

This comment has been minimized.

Copy link
Member

commented Jul 10, 2014

I think you might just want to create a custom format that behaves as you
are looking for (you can enable/disable any markdown features you want in a
custom format). See the docs here:
http://rmarkdown.rstudio.com/developer_custom_formats.html.

On Thu, Jul 10, 2014 at 3:15 PM, Ruben C. Arslan notifications@github.com
wrote:

Could you at least make proper line breaks an opt-in?
All of my academic colleagues are non-technical. They can use Markdown,
but not yet pandoc and they don't understand invisible characters at the
end
of a line being important. Neither do I.
On 10 Jul 2014, at 21:12, JJ Allaire notifications@github.com wrote:

Yes, that's the older version of R Markdown (which BTW also had the same
line breaking behavior, that was one place we differed from GitHub
flavored
markdown. The big reason we do this is for compatibility with pandoc,
which has become the defacto standard for markdown in technical/academic
communities.

On Thu, Jul 10, 2014 at 1:27 PM, Ruben C. Arslan <
notifications@github.com>
wrote:

I'm using Parsedown http://parsedown.org/ to generate non-dynamic
HTML
from markdown, and knitr/rmarkdown to generate dynamic HTML from rmd.

Parsedown has the Option setBreaksEnabled, where like here on Git
hub you can get a linebreak without ending the line with two spaces.

I always thought this was the only sane way to do it. According to
this
spec <
https://support.rstudio.com/hc/en-us/articles/200488468-R-Markdown>
you also want to support GH-flavoured Markdown, but maybe that's out
of
date?


Reply to this email directly or view it on GitHub
#164.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#164 (comment).

@rubenarslan

This comment has been minimized.

Copy link
Author

commented Jul 10, 2014

Could I also just pass hard_line_breaks to pandoc_args somehow?

@jjallaire

This comment has been minimized.

Copy link
Member

commented Jul 10, 2014

No, that won't work (it needs to be in the --to part of the command line).

Note that the reason we didn't allow cherry picking markdown features
directly in the YAML is because of the desire not to have a "balkanized"
markdown syntax in the community (where some docs handle things one way
while others do it another way). The idea is that if you have an R Markdown
document you always know how to correctly modify it without needing to
reference which markdown features are enabled/disabled.

You can of course do this with a bit more friction (a custom format) but if
you wrap that up in a package then it's very easy to use for your work or
for anyone else you share the package with.

On Thu, Jul 10, 2014 at 3:34 PM, Ruben C. Arslan notifications@github.com
wrote:

Could I also just pass hard_line_breaks
http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html to
pandoc_args somehow?


Reply to this email directly or view it on GitHub
#164 (comment).

@rubenarslan

This comment has been minimized.

Copy link
Author

commented Jul 10, 2014

I can understand the desire not to balkanize (though I'd say with Markdown we took a wrong turn to Sarajevo a long time ago maybe owing to Gruber's inactivity), but you must understand that by making it harder to go beyond the default (not putting it in the YAML), you open yourself to a questioning of what's best for the community.

I think there is a very strong case that using two spaces at the end of a line for linebreaks (or backslashes) goes against most people's intuition and the original WYSIWYG idea behind Markdown. It trips me up too and I've been using various flavours of MD for years.
For the technical community, the most well-known variant isn't pandoc's but Github's.

@jjallaire

This comment has been minimized.

Copy link
Member

commented Jul 10, 2014

There might be a strong case (I've seen the debate rage on in various
context over the years) but we've been doing it with the two spaces for the
last two years so to some extent a stake is already in the ground in the
context of R (if we changed the default from under people it would modify
their output).

We're going to keep our ear to the ground on the ability to tweak the
markdown flavor in the YAML -- will definitely consider this for a future
iteration.

On Thu, Jul 10, 2014 at 3:52 PM, Ruben C. Arslan notifications@github.com
wrote:

I can understand the desire not to balkanize (though I'd say with Markdown
we took a wrong turn to Sarajevo a long time ago maybe owing to Gruber's
inactivity), but you must understand that by making it harder to go beyond
the default (not putting it in the YAML), you open yourself to a
questioning of what's best for the community.

I think there is a very strong case that using two spaces at the end of a
line for linebreaks (or backslashes) goes against most people's intuition
and the original WYSIWYG idea behind Markdown. It trips me up too and I've
been using various flavours of MD for years.
For the technical community, the most well-known variant isn't pandoc's
but Github's.


Reply to this email directly or view it on GitHub
#164 (comment).

@rubenarslan

This comment has been minimized.

Copy link
Author

commented Oct 20, 2014

I tried my hand at this, is this how you would have done it? Manipulating the object returned by output_format seemed simpler and didn't require using the triple colon operator to pretend I'm in rmarkdown. OTOH I suppose I can't rely on this to keep working?

@rubenarslan

This comment has been minimized.

Copy link
Author

commented Oct 21, 2014

I think I've simplified my approach a little and have now set up markdown_github+yaml_metadata_blocks and defaults+hard_line_breaks.

The only thing that bothers me is that though I can indicate in the YAML which input format to use, I do this by specifying an "output" function, e.g.:
A bit confusing, right?

---
title: "Habits"
output:
  formr::markdown_hard_line_breaks
---
@jjallaire

This comment has been minimized.

Copy link
Member

commented Mar 31, 2015

Note that we've now added an md_extensions parameter to the output formats which would allow you to disable the line-break behavior on a per-document basis.

@jjallaire jjallaire closed this Mar 31, 2015
@rubenarslan

This comment has been minimized.

Copy link
Author

commented Mar 31, 2015

Yeah, I saw, good stuff :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.