(Djot) Incorrect header identifier in nested blocks
Omikhleia opened this issue · 0 comments
Omikhleia commented
Warning about duplicate identifiers errors when a header occurs in a block - e.g. a Blockquote, but more realistically in a Div used for styling -- and then internal links do not point to the correct element.
It's a misunderstanding on how the Djot section AST node behaves: We currently take the identifier to use on the rendered header from the previously seen section, ignoring a possible identifier on the header AST node itself.
However:
- A section is inserted when a header is found at the document level, and the id is set on the section, not on the header.
- In nested blocks (e.g. in divs), there's not section wrapped, and the id is set on the header.
Note by the way that with our version of djot.lua, other attributes are always on the header (differing from djot.js and the online Djot playground at the current date)
See also jgm/djot#213 for reference.