User:Puxlit/Experiments/WideTwoLevelTOC

The goal is to replace the existing manual tables of contents (TOCs) found in each character's synopsis and relationships subpages with the automatic TOC, styled to match the manual TOC's design. A full list of affected pages (with a few false positives) can be found here.

Here's an example of a manual TOC.

Markup Rendered

Here's an example of how we could match that design with automatic TOCs.

Markup CSS /* Wide two-level TOC: resets (including for wrapper generated by w:c:dev:MediaWiki:FloatingToc/code.js via MediaWiki:Wikia.js) */ .toc-widetwolevel #toc-wrapper { margin: 0 !important; max-width: none !important; width: 100%; } .toc-widetwolevel nav.toc li::before { content: none; } /* Wide two-level TOC: overrides */ .toc-widetwolevel nav.toc { display: block; text-align: center; } .toc-widetwolevel #toctitle h2 { font-weight: bold; } .toc-widetwolevel nav.toc ol { margin: 0; } .toc-widetwolevel nav.toc li { display: inline; } .toc-widetwolevel nav.toc li.toclevel-1 { font-weight: bold; } .toc-widetwolevel nav.toc li.toclevel-2 { font-weight: normal; } .toc-widetwolevel nav.toc li.toclevel-2 > ol { display: none; } .toc-widetwolevel nav.toc li.toclevel-1:not(:last-child) > a:only-child, .toc-widetwolevel nav.toc li.toclevel-2:not(:last-child) > a { margin-right: 1em; } .toc-widetwolevel nav.toc li.toclevel-1:not(:last-child) > a:only-child::after, .toc-widetwolevel nav.toc li.toclevel-2:not(:last-child) > a::after { display: inline-block; width: 0; line-height: 0; position: relative; left: 0.5em; pointer-events: none; color: #3a3a3a; content: "•"; } Rendered

NB: Unless those styles have been included, the above demo will look identical to the default TOC. To inject those styles temporarily into this page, run the following JS in your browser's console.

(function{const x=document.createElement('style');x.appendChild(document.createTextNode('.toc-widetwolevel #toc-wrapper{margin:0 !important;max-width:none !important;width:100%}.toc-widetwolevel nav.toc li::before{content:none}.toc-widetwolevel nav.toc{display:block;text-align:center}.toc-widetwolevel #toctitle h2{font-weight:bold}.toc-widetwolevel nav.toc ol{margin:0}.toc-widetwolevel nav.toc li{display:inline}.toc-widetwolevel nav.toc li.toclevel-1{font-weight:bold}.toc-widetwolevel nav.toc li.toclevel-2{font-weight:normal}.toc-widetwolevel nav.toc li.toclevel-2 > ol{display:none}.toc-widetwolevel nav.toc li.toclevel-1:not(:last-child) > a:only-child,.toc-widetwolevel nav.toc li.toclevel-2:not(:last-child) > a{margin-right:1em}.toc-widetwolevel nav.toc li.toclevel-1:not(:last-child) > a:only-child::after,.toc-widetwolevel nav.toc li.toclevel-2:not(:last-child) > a::after{display:inline-block;width:0;line-height:0;position:relative;left:0.5em;pointer-events:none;color:#3a3a3a;content:"•"}'));document.head.appendChild(x)});

Otherwise, here's a screenshot of the manual TOC followed by the restyled default TOC.

https://puxlit.s3.amazonaws.com/misc/wikia-bnha-experiments-widetwoleveltoc-screenshot.thumb.png

What follows is filler content (so the default TOC has something to display).

Izuku Midoriya
Lorem ipsum dolor sit amet.

Level Six Heading
These headings should not appear in the TOC.

Shoto Todoroki
Lorem ipsum dolor sit amet.

Eijiro Kirishima
Lorem ipsum dolor sit amet.

Eraserhead
Lorem ipsum dolor sit amet.

Fumikage Tokoyami
Lorem ipsum dolor sit amet.

Mashirao Ojiro
Lorem ipsum dolor sit amet.

Denki Kaminari
Lorem ipsum dolor sit amet.

Site Navigation
Lorem ipsum dolor sit amet.