Skip to content

Table of contents not linked when generating html from org file #2354

Closed
jg opened this Issue · 7 comments

3 participants

@jg
jg commented

I'm generating an html file from my org file. I'd like to include a table of contents.

pandoc -s -S --toc file.org -o file.html

The org file has three simple first level headings.

* item 1
* item 2
* item 3

Unfortunately the output table of contents is not linked. The links are missing their href attributes.

<div id="TOC">
<ul>
  <li><a>item 1</a></li>
  <li><a>item 2</a></li>
  <li><a>item 3</a></li>
</ul>
@jgm jgm added a commit that closed this issue
@jgm HTML reader: add auto identifiers if not present on headers.
This makes TOC linking work properly.

The same thing needs to be done to the org reader to fix #2354;
in addition, `Ext_auto_identifiers` should be added to the list
of default extensions for org in Text.Pandoc.
2eec8cf
@jgm jgm closed this in 2eec8cf
@jgm jgm reopened this
@jgm
Owner
jgm commented

@tarleb, what do you think? The trick is to use registerHeader, which does all the work behind the scenes, but you need to define certain instances for OrgParserState for this to work.

@tarleb

Apologies for the late reply. I didn't find the time yet for this, but I keep it in mind and will take a look when things calm down a little. It's on my todo list.

@jg jg added a commit to jg/pandoc that referenced this issue
@jg jg Org reader: add auto identifiers if not present on headers
Refs #2354

This should also fix the table of contents (--toc) when generating a html file
from org input
f1c87ed
@jg
jg commented

I see pandoc master failing for GHC 7.10.1. Do we care about 7.10.1 compatibility? CONTRIBUTING.md could use a pragraph about that

@jgm
Owner
@jgm
Owner
@jgm
Owner

Closed by #2360

@jgm jgm closed this
@jgm
Owner

Btw, travis builds currently fail for ghc 7.10 due to a
cabal version mismatch in running tests, which makes 'cabal
test' fail. I think this is a cabal bug; do you know how to
make it go away?

Fixed this by using cabal-install-head in the travis build for ghc 7.10.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.