Extension:SectionHide

The SectionHide extension adds a [hide] link wherever there is a section heading [edit] link. This link will hide all content between that section header and the next section header of the same level, changing itself to read [show] in the process. Clicking [show] will restore the section to view.

Example
Illustration showing how each hide link conceals the related block in a nested fashion while keeping the title visible.



Mediawiki:Common.js
Add this here, or in individual skins

Versions
Added a hide/show all link at the top
 * Version 1.1

Added an option to keep the content before the first X-1 headings visible when using the hide all link. NB set to 1 to hide everything from the first heading to the end.
 * Version 1.2

Using anything other than 1 means that divs are overlapping instead of nested, which is a standards violation in xhtml . Mediawiki is still using HTML, however, so overlapping is tolerated and most browsers deal with it. Some may have issues. By the same token, any divs in the actual text that cross over headings will potentially cause a problem, which is why every closing tag added has an id attribute to match it with the opening tag.

Author Notes
Several similar extensions were created in the past, but they are not maintained and didn't do quite what I needed.