Reputation: 249
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 ?
Upvotes: 8
Views: 3710
Reputation: 8937
Newer pandoc versions support --wrap=preserve
.
Pandoc does not distinguish between newlines and other whitespace (outside of <pre>
tags), since these are not semantically different in HTML.
Upvotes: 3
Reputation: 849
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.
Upvotes: 7
Reputation: 5645
I had the same problem. What I did what to replace each newline with <p></p>
string with additional <p>
and </p>
at the beginning and end. Then I passed the text to pandoc. It worked well.
Upvotes: 0
Reputation: 1136
Use <pre>
tags wherever whitespace needs to be preserved. Have you tried  
or <br>
Upvotes: 0