Extension:HeaderSections

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:MIT licensed extensions
MediaWiki extensions manual
HeaderSections
Release status: stableCategory:Stable extensions
Implementation User interfaceCategory:User interface extensions, Skin Category:Skin extensions
Description A MediaWiki extension that adds a CSS class to the section of content below a header.
Author(s) Derf Jaggedtalk
Latest version 1.0 (2022-12-30)
MediaWiki 1.25+Category:Extensions with manual MediaWiki version
PHP 5.5+
Database changes No
License MIT License
Download Category:Extensions in GitHub version control
Example ConsoleMods.org
Category:All extensionsCategory:Extensions not in ExtensionJson

HeaderSections is a MediaWiki extension that adds a CSS class to the section of content below a header. This effectively allows for CSS styling to be applied to sections such as different background colors or indent levels for H2 and H3 sections or to target a certain section type using your own custom JavaScript. This extension is based on the HideSection extension.

This extension tags sections hierarchically, meaning a nested element under multiple parent headers will have current section tag (e.g. H3-section) and all parent section tags (e.g. H1-section and H2-section).

For reporting an issue or a bug, please open a GitHub issue.

Installation

Requires MediaWiki 1.25 or higher for wfLoadExtension registration.

  • Download and place the file(s) in a directory called HeaderSections in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'HeaderSections' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

ext.headersections.css - Edit contents of stylesheet as desired.

Your CSS rules in ext.headersections.css needs to be in the proper order so that the higher numbered section rules (H4) take precedence over the lower-numbered section rules (H3).

Default configuration is set to indent each section following a header by an increasing amount using these CSS classes:

.H1-section
.H2-section
.H3-section
.H4-section
.H5-section
.H6-section

See also

Category:All extensions Category:BeforePageDisplay extensions Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:MIT licensed extensions Category:Skin extensions Category:Stable extensions Category:User interface extensions