Manual:Hooks/ParserSectionCreate

Category:MediaWiki hooks#ParserSectionCreate Category:Hooks added in MediaWiki 1.19.0#ParserSectionCreate Category:MediaWiki deprecated or obsolete features#ParserSectionCreate Category:Hooks removed in MediaWiki 1.40.0#ParserSectionCreate Category:Hooks deprecated in MediaWiki 1.35.0#ParserSectionCreate
ParserSectionCreate
Available from version 1.19.0 (r92506, CodeReview archive)
Removed in version 1.40.0 (Gerrit change 861504)Category:Removed hooks#ParserSectionCreate
Called each time the parser creates a document section from wikitext.
Define function:
public static function onParserSectionCreate( $parser, $section, &$sectionContent, $showEditLinks ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ParserSectionCreate": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserSectionCreate"
	}
}
Called from: File(s): parser/Parser.phpCategory:MediaWiki hooks included in Parser.php#ParserSectionCreate
Interface: ParserSectionCreateHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ParserSectionCreate extensions.

Details

Use this to apply per-section modifications to HTML (like wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV can begin in one section and end in another. Make sure your code can handle that case gracefully.

  • $parser: the calling Parser instance.
  • $section: the section number, zero-based, but section 0 is usually empty.
  • &$sectionContent: ref to the content of the section. modify this.
  • $showEditLinks: boolean describing whether this section has an edit link.
Category:Hooks added in MediaWiki 1.19.0 Category:Hooks deprecated in MediaWiki 1.35.0 Category:Hooks removed in MediaWiki 1.40.0 Category:MediaWiki deprecated or obsolete features Category:MediaWiki hooks Category:MediaWiki hooks included in Parser.php Category:Removed hooks