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

Add support for the backslash variant of a hard line break to GFM input #519

Closed
mojavelinux opened this issue Jun 2, 2018 · 6 comments
Closed

Comments

@mojavelinux
Copy link
Contributor

@mojavelinux mojavelinux commented Jun 2, 2018

GFM (as well as CommonMark) allow a hard line break to be defined using a single trailing backslash.

foo\
bar

This should produce:

[<kd:text "foo">, <kd:br>, <kd:text "\nbar">]

(See https://spec.commonmark.org/0.28/#hard-line-breaks)

I also think the parser should remove the newline from the start of the second line of text.


It's also interesting to note that GFM no longer interprets hard line breaks (hard_wrap) by default. It's easy enough to set this option to false, but it might be appropriate to reconsider it as the default option.

@gettalong
Copy link
Owner

@gettalong gettalong commented Jun 2, 2018

Thanks - pull requests are welcome!

@mojavelinux
Copy link
Contributor Author

@mojavelinux mojavelinux commented Jun 2, 2018

Thanks for reviewing, @gettalong. Pull request sent!

@mojavelinux
Copy link
Contributor Author

@mojavelinux mojavelinux commented Jun 2, 2018

The good news is that this is a very low impact change. The backslash hard line break is only supported for GFM (which is true, since it's not in strict markdown) and it is only enabled when hard wrap is off.

@gettalong gettalong closed this in b393793 Jun 2, 2018
@gettalong
Copy link
Owner

@gettalong gettalong commented Jun 2, 2018

Thanks for your contribution!

@gettalong
Copy link
Owner

@gettalong gettalong commented Jun 2, 2018

As for changing the default value of the hard_wrap option: I'm not sure whether this is a good idea since it may impact many people who depend on the current behaviour.

@mojavelinux
Copy link
Contributor Author

@mojavelinux mojavelinux commented Jun 2, 2018

You're welcome!

As for the hard_wrap option, I agree that could be a big change. Perhaps the right thing to do would be to note in the documentation / website that GFM with hard_wrap: false is technically the most true to GFM.

(The reason for the recommendation has to do with the fact that GFM is now based on CommonMark, so GFM isn't the same as it used to be).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants