2

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?

Stephan Muller
  • 27,018
  • 16
  • 85
  • 126
r0estir0bbe
  • 699
  • 2
  • 7
  • 23
  • Your approach, though hackish, and probably better replaced by a custom extension, works perfectly fine for me. Do you have a link to the page where it doesn't work? – leo Sep 19 '14 at 19:27
  • @leo Interesting. I just tried it in the Wikipedia sandbox and there it actually works. On [this wikipage](http://twewy.wikia.com/wiki/User:ShihiZu/Sandbox/TOC_entry), it doesn't... – r0estir0bbe Sep 19 '14 at 19:56
  • 1
    Added Wikia tag, as this seem to be specific to Wikia. Wikia uses one or two TOC specific extensions to override the default MediaWiki table of content, so some MW hacks might not work there – leo Sep 19 '14 at 20:07

1 Answers1

0

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.

Nemo
  • 2,441
  • 2
  • 29
  • 63