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

Incorrect parsing of hard line break in markdown #39103

Closed
oxinabox opened this issue Jan 5, 2021 · 4 comments
Closed

Incorrect parsing of hard line break in markdown #39103

oxinabox opened this issue Jan 5, 2021 · 4 comments
Labels
docsystem The documentation building system

Comments

@oxinabox
Copy link
Contributor

oxinabox commented Jan 5, 2021

Both the spec for Github Flavoured Markdown and CommonMark state:

A line break (not in a code span or HTML tag) that is preceded by two or more spaces and does not occur at the end of a block is parsed as a hard line break (rendered in HTML as a
tag):

But if you write such code in Julia, that new line is just replaced with a space; as if it were not preceded by two spaces in the source.

julia> md"foo
       bar".content
1-element Vector{Any}:
 Markdown.Paragraph(Any["foo   bar"])

The correct output would be

1-element Vector{Any}:
Markdown.Paragraph(Any["foo\nbar"])

This forces extra line breaks in #39093 as there is no way to have a linebreak without inserting a full blank line (i.e. making two Markdown.Paragraphs)

@mgkuhn
Copy link
Contributor

mgkuhn commented Jan 5, 2021

Git diff (by highlighting them in red) and many programming style guidelines discourage trailing whitespace in source code. Many authors will use editor functions (such as M-x delete-trailing-whitespace in emacs) to remove trailing whitespace, as most of it is added accidentally and considered bad style. Supporting trailing whitespace as part of the Julia source-code syntax seems like a bad idea to me. It will get removed by accident very frequently.

@oxinabox
Copy link
Contributor Author

oxinabox commented Jan 5, 2021

This is true, I am not at all a fan of this part of the markdown; but i didn't write it.
We do need a way to insert hardline break.
We could allow <br> /<br/> to be used.
which is what i normally do when using markdown engines that suppprt HTML

@mgkuhn mgkuhn added the docsystem The documentation building system label Jan 5, 2021
@MichaelHatherly
Copy link
Member

Related: #16004

@oxinabox
Copy link
Contributor Author

oxinabox commented Jan 5, 2021

Related: #16004

seems like this is an outright duplicate

@oxinabox oxinabox closed this as completed Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system
Projects
None yet
Development

No branches or pull requests

3 participants