[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: id attributes for header elements
From: |
Per Bothner |
Subject: |
Re: id attributes for header elements |
Date: |
Sun, 26 Dec 2021 10:08:50 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 |
On 12/26/21 09:30, Patrice Dumas wrote:
On Sat, Dec 25, 2021 at 02:10:29PM -0800, Per Bothner wrote:
Two requests:
(1) Don't generates the implicit id="Electron-1" when it immediately follows
an explicit id="Electron".
I do not think that it is a good idea, the @anchor anchor and id should
stay different from the @node, or section @-command id and anchor. It
is better to keep it, but it would probably be even better to have a
class to make it possible to select @anchor generated anchors.
Maybe - is there a use-case for this?
(2) Add the id attribute to the <h4> element rather than generate an empty
<span> node.
I did something along those lines, but not when there is a header, in
order to keep the anchor before the header, as it was agreed, long ago
that having the anchor before the header was better for navigation.
I don't remember, and I don't see how it could be better for navigation..
I don't see any particular use for being able to distinguish referenes
generated by @anchor from others.
However, since @anchor can be anywhere (including the middle of paragraphs),
there is an argument from simplicity and consistency for just using an empty
<span>.
Though note that best practices for (hard-written) HTML would be to place
the id to a semantically meaning element.
Regardless, the implicit id that is generated for a heading command belongs
on the header element. I.e. for
@anchor{Electron}
@subheading Electron
we should at least do:
<span id="Electron"></span><h4 id="Electron-1" class="subheading">Electron</h4>
Since id="Electron-1" is directly generated by the @subheading, it makes sense
to put the id attribute be on the generated h4 element.
--
--Per Bothner
per@bothner.com http://per.bothner.com/