jgm/pandoc

Linebreaks in org mode

samhedin opened this issue · 3 comments

First of all, thank you for pandoc!

Following this: https://groups.google.com/g/pandoc-discuss/c/hhLqIuBwowQ/m/NFIgfX-BBQAJ
I have solved the issue of Space leading to linebreaks by replacing them with Str " ", but I have not figured out what to do about the extra linebreaks after headers. As you can see in the image in the linked discussion, these additional linebreaks can take up quite a bit of extra space if you have a lot of headers.

Example pandoc test.html -o test.org

Input test.html

<h1>I am a header</h>
<p>I am some text</p>

Observed test.org

* I am a header
  :PROPERTIES:
  :CUSTOM_ID: i-am-a-header
  :END:

I am some text

Expected test.org

* I am a header
  :PROPERTIES:
  :CUSTOM_ID: i-am-a-header
  :END:
I am some text

Example pandoc test.md -o test.org

test.md

# I am a header
I am some text

Observed test.org

* I am a header
  :PROPERTIES:
  :CUSTOM_ID: i-am-a-header
  :END:

I am some text

Expected test.org

* I am a header
  :PROPERTIES:
  :CUSTOM_ID: i-am-a-header
  :END:
I am some text
$ pandoc --version
pandoc 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.2, skylighting 0.8.5
Default user data directory: /home/sam/.local/share/pandoc or /home/sam/.pandoc
Copyright (C) 2006-2020 John MacFarlane
Web:  https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

I have a similar issue with line breaks when trying to convert opml to org, where the linebreak between every single heading gets doubled.
Here's an example of the opml file I was dealing with (they were exported from Workflowy, an outliner similar to Dynalist):
https://raw.githubusercontent.com/archiif/random/master/workflowy-export.opml
And the resulting org file:
https://raw.githubusercontent.com/archiif/random/master/workflowy-export.org
Is this issue relevant to mine, or should I open a different one?