1

I'm trying to use Org mode's export to markdown, and am finding some unexpected results.

For a file:

* Section

This is some test.[fn:1]
@@markdown:This should appear in markdown export.@@

* Footnotes

[fn:1] This is a footnote.

The export backend produces:

# Table of Contents

1.  [Section](#org26628a6)


<a id="org26628a6"></a>

# Section

This is some test.<sup><a id="fnr.1" class="footref" href="#fn.1">1</a></sup>


# Footnotes

<sup><a id="fn.1" href="#fnr.1">1</a></sup> This is a footnote.

Which looks very much like a mixture of markdown with html markup. Plus @@markdown: ...@@ does not seem to work.

What am I missing? Any ideas of how I could get better results?

Update: Says the Org mode manual:

The md back-end is built over HTML back-end: any construct not supported by Markdown syntax (e.g., tables) will be controlled and translated by ‘html’ back-end.

So that's probably the explanation to the result, as neither ToC nor footnotes seem to be supported by vanilla markdown.

1

If you want more flexibility in your markdown export you should look at pandoc and ox-pandoc

  • 1
    Thank you. I'm aware of pandoc, but things are definitely more convenient from within Emacs. As to ox-pandoc I experimented with it, but it broke my regular LaTeX export. I'm not sure why, perhaps I'm to blame. But as I installed it from MELPA, it brought Org mode 9 with it, while I have a repo installation with Org mode 8.2. – gusbrs Jun 3 '18 at 3:18
  • Hmm. Not sure why it would break your LaTeX export. Though pandoc/ox-pandoc uses its own template system for latex-pdf export. But in general I'd say use the newer Org if you can. You can also control pandoc directly with pandoc-mode. – mclear Jun 3 '18 at 16:21
  • I also don't know why, but I'm sure it did. It converted #+BEGIN_LATEX to \begin{LATEX} and thus broke latex compilation. And it took me a good afternoon of debugging my setup to nail the culprit in ox-pandoc. I'll take a look at pandoc-mode though. Thanks again! – gusbrs Jun 3 '18 at 16:40
  • I must rectify something here regarding ox-pandoc. Apparently, the syntax #+BEGIN_LATEX no longer works for recent versions of Org mode, while #+BEGIN_EXPORT latex does. So, as I used the former in my document and ox-pandoc brought a recent version of Org mode with it, I ended up with an uncompilable document. – gusbrs Jun 6 '18 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.