-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Hard line breaks are not working in .md files #265
Comments
recommonmark, the library rinohtype relies on for CommonMark support, translates this line break to a raw HTML node. rinohtype ignores raw nodes meant for other docutils writers (as it should). Output from <document source="line_break.md">
<paragraph>
The following text should be on a new line
<raw format="html" xml:space="preserve">
<br />
"
This should be on the next line
" I think recommonmark outputs a raw node because docutils doesn't offer a hard line break node, as far as I know. Instead, recommonmark should transform a paragraph containing a hard line break to a line block so that it can be rendered properly by non-HTML writers. You could open a ticket with recommonmark, but I see that package is now deprecated, so we might need to move away from it. The README recommends using MyST instead. Another option is pycmark. |
Heya, author of MyST here, certainly interested in rinohtype supporting MyST, since we were looking at in for https://github.com/executablebooks/jupyter-book 😄 cc @choldgraf |
That would be a great use case for rinohtype! If MyST can output to a plain docutils/Sphinx document tree, adding a MyST frontend to rinohtype should be trivial (see the CommonMark frontend code for reference). Is this something you want to try and implement? I'll be on vacation until late September, but I can help out when I'm back. |
It can indeed 👍 |
@chrisjsewell Reminded of this by #370, I had a go at replacing recommonmark with MyST and it turned out to be dead-simple! I did see an issue with relative links, however: #370 (comment) Also, the line break issue described in this very issue persists with MyST. (using trailing spaces to indicate a line break -- or anything else, really -- is a horrible choice though /rant) |
According to the specs of CommonMark, you can set a hard line break by adding 2 or more spaces at the end of a line that is not the end of a block.
Here is an example markdown file: line_break.md
The PDF output is this: line_break.pdf
The expected output is that
"This should be on the next line"
is on the next line.The command I used to create the PDF is:
rinoh line_break.md
commonmark.js shows it correctly https://spec.commonmark.org/dingus/?text=The%20following%20text%20should%20be%20on%20a%20new%20line%20%20%0A%22This%20should%20be%20on%20the%20next%20line%22%0A
CommonMark hard line break spec: https://spec.commonmark.org/0.29/#hard-line-break
Installed versions:
The text was updated successfully, but these errors were encountered: