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

[[tag]] in section title shouldn't be rendered in TOC #840

Closed
fishy opened this Issue Dec 5, 2013 · 7 comments

Comments

Projects
None yet
2 participants
@fishy

fishy commented Dec 5, 2013

Have the following as section title:

[[auth]]Section auth

It's rendered in TOC as:

<a href="#__a_id_auth_a_section_auth"><a id="auth"></a>Section auth</a>

Because of the a tag inside an a tag thing, the link won't be rendered in Chrome. Also the a tag inside will cause 2 anchors of "auth".

@ghost ghost assigned mojavelinux Dec 6, 2013

@mojavelinux

This comment has been minimized.

Member

mojavelinux commented Dec 6, 2013

I completely agree! This is something I really don't like at all in AsciiDoc Python and I'd like to improve the situation in Asciidoctor.

If you need a more short-term solution, you can leverage another syntax option available in Asciidoctor:

[#auth]
== Section auth
@fishy

This comment has been minimized.

fishy commented Dec 6, 2013

I tried it with asciidoc 8.6.9 and it don't have this problem, but it uses javascript to generate TOC, that might be the reason.

Thanks for the workaround!

@mojavelinux

This comment has been minimized.

Member

mojavelinux commented Dec 7, 2013

I tried it with asciidoc 8.6.9 and it don't have this problem, but it uses javascript to generate TOC, that might be the reason.

Exactly. AsciiDoc makes this mistake when other HTML is in the title. Asciidoctor just hits it sooner because it does things slightly differently.

@mojavelinux

This comment has been minimized.

Member

mojavelinux commented Jan 5, 2016

Coming back to this, I remembered that if you move the anchor to the end of the section title rather than the beginning, that's the inline way of assigning an id in Asciidoctor (and not create an inline anchor point).

== Section auth [[auth]]

You only use the prefix version when you want to add additional anchor points. And it's in those cases we need to make sure it doesn't show up in the TOC.

@mojavelinux

This comment has been minimized.

Member

mojavelinux commented Jan 5, 2016

Here's a specific example I think we should test for. This is a recognized way to assign an id and add an additional anchor point to a section title.

== Section A[[origins]] [[section-a]]

Here, the id is reasonable (since it's explicit), but a duplicate anchor shows up in the TOC entry, rendering the HTML document invalid.

@mojavelinux mojavelinux modified the milestones: v1.5.5, v1.6.0 Jan 5, 2016

@mojavelinux

This comment has been minimized.

Member

mojavelinux commented Jan 5, 2016

I think in general, we need to clean <a> tags from the section title when generating the id and when rendering them in the TOC. That's the actionable item here.

@mojavelinux

This comment has been minimized.

Member

mojavelinux commented Apr 17, 2018

I'm reclassifying as a bug since this a) creates a duplicate ID in the document and b) renders the link in the TOC unusable.

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