Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple heading ids #2396

Closed
van-de-bugger opened this issue Sep 14, 2015 · 3 comments
Closed

Multiple heading ids #2396

van-de-bugger opened this issue Sep 14, 2015 · 3 comments

Comments

@van-de-bugger
Copy link

pandoc documentation says:

A header without an explicitly specified identifier will be automatically assigned a unique identifier based on the header text.

However, pandoc assigns an identifier even if identifier is already set, causing incorrect HTML output:

$ ~/.cabal/bin/pandoc --version
pandoc 1.15.0.6
Compiled with texmath 0.8.3, highlighting-kate 0.6.
...

$ cat input.md 
# Chapter 1 {id="ch01"}

text

$ ~/.cabal/bin/pandoc -f markdown -t html -o output.html input.md 

$ cat output.html 
<h1 id="chapter-1" id="ch01">Chapter 1</h1>
<p>text</p>

Note: h1 tag has two id attributes.

@jgm
Copy link
Owner

jgm commented Sep 14, 2015

The standard way to set an id in pandoc is

# Chapter 1 {#ch01}

If you do it this way, it will work the way the docs say.
But probably we should ensure that if someone says id=foo, it
has the same effect.

@ousia
Copy link
Contributor

ousia commented Sep 14, 2015

@van-de-bugger,

from this source:

# Chapter 1 {#ch1}
# Chapter 2 {id="ch2"}

you will have this HTML output (using latest stable pandoc):

<h1 id="ch1">Chapter 1</h1>
<h1 id="chapter-2" id="ch2">Chapter 2</h1>

Extended Markdown requires identifiers tagged as {#identifier} and classes as {.class}.

Just in case it might help.

@van-de-bugger
Copy link
Author

Thanks, I am aware about {#id} syntax, but I think {id="id"} is also valid.

@jgm jgm closed this as completed in dcb0b02 Sep 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants