1. André Felipe Dias
  2. rst2html5
Issue #6 resolved

Instead of an <a id="#...."> anchor use <tag id="#....">

Russ Webber
created an issue

HTML5 lets us place id's into the section tag (and others) which will make it behave as an anchor and facilitate internal page linking.

(by the way, once I understand the codebase I'm intending on [attempting to] providing some patches :) )

I imagine there are a few tags that could implement this, such as:

  • figure
  • aside which table of contents seems to be mapped to

However: HTML5 id's can only contain one id. If we come across something like this (which is from the functional test):

.. _Another Target:

Targets
-------

<section id="targets another-target"> would be incorrect (which is what happens if I change self.expand_id_to_anchor = False. I think the most desirable outcome would be:

<a id="another-target"></a>
<section id="targets">

Comments (9)

  1. André Felipe Dias repo owner

    This implementation was intentional. Since the generated ids serve only to navigational purposes, I thought they are better kept separated. But now, this doesn't look so good. I'll investigate further.

  2. Russ Webber reporter

    Having section ids would allow for easy manipulation of the document via JS, i.e. expanding, collapsing, all that good stuff, which may not be a motivation of yours, but it's a nice-to-have and will enable people to create some pretty impressive output :).

  3. Log in to comment