How to add an invisible entry to a Wiki TOC?

421 views Asked by At

I would like to add an entry to the table of contents of a wiki page that links to an arbitrary point inside the article. In my use case, I want to link to multiple 'header rows' inside a long table. I tried both

<h4 style="display: none;">My invisible TOC entry</h4>

as well as

<div style="display: none;">My invisible TOC entry</h4>

However, it seems that the element does not get rendered at all. How do I add such an invisible entry?

1

There are 1 answers

0
Nemo On

I'll reply to your use case directly: «I want to link to multiple 'header rows' inside a long table».

I usually recommend to use normal headers in such cases. You will even be able to do section editing of the sub-table (or row) without breaking the general table. An example of sections which reuse existing cells/headers is the Feature map on mediawiki.org.

Alternatively, to have really invisible anchors, you can just add a <span id=linkme></span> or similar, often done via an {{anchor}} template.

Middle ways, i.e. anchors which are actually sections and display in the TOC, but are hacked and made inservible for viewing and section editing, don't really look like "solutions" to me.