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

Unlinked TOC with commonmark[_x]? #6863

Closed
jaybe-jekyll opened this issue Nov 20, 2020 · 7 comments
Closed

Unlinked TOC with commonmark[_x]? #6863

jaybe-jekyll opened this issue Nov 20, 2020 · 7 comments

Comments

@jaybe-jekyll
Copy link

I noticed that using -f commonmark_x (or commonmark) with --toc will produce a table of contents however the contents are not hyperlinked to their sections.

Is this the expected behavior?

I experimented and got hyperlinks by adding +gfm_auto_identifiers.

@jaybe-jekyll jaybe-jekyll changed the title Unlinked TOC with commonmark_x Unlinked TOC with commonmark[_x]? Nov 20, 2020
@mb21
Copy link
Collaborator

mb21 commented Nov 20, 2020

What output format? Have you tried with the latest pandoc version?

@jaybe-jekyll
Copy link
Author

Out format is html.

Latest pandoc release.

@tarleb
Copy link
Collaborator

tarleb commented Nov 20, 2020

Pandoc can only link to elements of which it knows the ID. This is why you got the expected result when using +gfm_auto_identifiers. You could also manually add an id to each header: ## some header {#my-id}.

So yes, this is basically intended behavior. Maybe it would be worth to mention the above in the manual?

@tarleb tarleb added the docs label Nov 20, 2020
@jaybe-jekyll
Copy link
Author

Should not auto_identifiers (enabled with commonmark_x) provide for this?

Extension: auto_identifiers

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

@tarleb
Copy link
Collaborator

tarleb commented Nov 20, 2020

Oh, right. That's weird then.

@jgm
Copy link
Owner

jgm commented Nov 20, 2020

OK, I see the issue.
commonmark_x includes auto_identifiers. But auto_identifiers doesn't actually have any effect on the commonmark reader; only gfm_auto_identifiers triggers the autoIdentifierSpec. This is correct, I think, because the autoIdentifierSpec from commonmark implements the gfm style of identifiers. But we should include gfm_auto_identifiers, rather than auto_identifiers, in commonmark_x.

@jgm jgm closed this as completed in c647948 Nov 20, 2020
@jaybe-jekyll
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants