markdown-pdf
markdown-pdf copied to clipboard
markdown-pdf creates extra lines breaks
When markdown-pdf encounters the following text:
foo
bar
baz
it will create three lines, while the standard markdown behavior is to put all those into one line and create a new paragraph if an empty line is encountered.
It would be great to be able to use the standard markdown behavior.
We use remarkable for Markdown parsing, which uses something similar to Github Flavoured Markdown by default. It supposedly supports CommonMark, and we have a --remarkable-options flag to change its options, but for some reason, it's CommonMark support isn't invoked with a property in the option object, but as a string argument to its constructor.
I tried calling markdown-pdf with --remarkable-options='"commonmark"', but get the same result. :angry:
@anko remarkable does not do extra line breaks by default. You can try the demo here: https://jonschlinkert.github.io/remarkable/demo/
The breaks: true on this line https://github.com/alanshaw/markdown-pdf/blob/master/index.js#L28 is doing it. That part should be removed.
In the mean time you can fix it by adding breaks: false to opts.remarkable. From the CLI, I am currently using:
markdown-pdf -m '{"breaks":false}' [file]
First, excellent job with this. Years ago I had a Markdown to PDF converter via Ruby that was quite large. This brings it down to almost a command line. (I still need Markdown to ePUB to Mobi.)
I ran into the same problem, where line breaks within a paragraph. This (naturally) fixed it. Perhaps change the default from true to false, or put in the documentation and close this? :)