pandoc handling of newlines when converting from/to docx

Viewed 910

I am using pandoc to convert between .docx and .org formats so that I can edit them in a plaintext editor like emacs.
pandoc has a mind of its own regarding linebreaks/newlines.

Converting from .docx to .org:

  1. When the .docx document has a newline, pandoc places a double newline.
  2. pandoc removes multiple intentional newlines.

Example:
test-doc.docx:


Line one


Line two
Line three

The command:
> pandoc -s test-doc.docx -o test-doc.org

outputs test-doc.org:


Line one

Line two

Line three

Converting from .org to .docx:

  1. Pandoc removes newlines.

Example:
test-doc2.org:


Line one and
then line two.
The command:
> pandoc -s test-doc2.org -o test-doc2.docx

outputs test-doc2.docx:


Line one and then line two.

This behavior is not corrected by using the pandoc --wrap flags.
This behavior is the same for .docx files created with MS Word and Google Docs.
This behavior is the same when converting between .docx and markdown (.md) format.
This is pandoc version 2.10.1 on Windows.
I would like to get newlines to be converted faithfully between .docx and .org formats.
Thank you for any suggestions.

0 Answers
Related