Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linebreaks removed by pandoc

I am using pandoc to translate from html to markdown.
Pandoc is removing linebreak in the results.

Here is the command I am using:

pandoc -f html -t markdown_phpextra myfile.html

Is there any way for keeping all the linebreaks in the html file ?

like image 886
Ben Avatar asked Apr 20 '13 15:04

Ben


2 Answers

Digging up an old question since I just discovered that you can specify a Pandoc extension for this:

pandoc -f markdown+hard_line_breaks -t html myfile.html

That worked for me (notice that I used regular markdown, though). See also pandoc's man page for further explanations.

like image 54
martz Avatar answered Sep 21 '22 11:09

martz


Newer pandoc versions support --wrap=preserve.

Old answer:

Pandoc does not distinguish between newlines and other whitespace (outside of <pre> tags), since these are not semantically different in HTML.

like image 2
John MacFarlane Avatar answered Sep 21 '22 11:09

John MacFarlane