vimwiki
vimwiki copied to clipboard
Identical IDs for div and h-tags
Currently a heading like == foo ==
is converted to something like <div id="foo"><h2 id="foo">foo</h2></div>
– this is invalid HTML, since id's must be unique.
Note corresponding code is in function process_tag_h()
in html.vim.
TODO:
- [ ] understand for what the div is good for.
There are two ways to make a link to an anchor in Vimwiki: [file#anchor]
and [file#header1#header2#anchor]
, where you provide the complete header hierarchy. Because of this, an anchor needs two id's. The div is just a dummy tag so that you can give two id's to one header.
Looks like this is only an issue if there isn't higher level header.
For example:
= Header 1 =
== foo ==
Renders:
<div id="Header 1-foo"><h2 id="foo" class="header"><a href="#Header 1-foo">foo</a></h2></div>
It seems like this is fairly harmless unless trying to use the id with javascript or something.
I just noticed this while looking at @chipsenkbeil's vimwiki-rs HTML generation, where it's duplicated.