[MediaWiki-l] how to make mediawiki make TOC with less than 4 sections ?

Bartosz Dziewoński matma.rex at gmail.com
Thu Oct 15 17:25:53 UTC 2015

On 2015-10-14 16:44, shirish wrote:
> Hi all,
> A temporary way to generate Table of Contents (TOC) is to write
> __FORCETOC__ or _TOC_ before starting the page but what if we don't want
> that. Let's say we want to have all and any pages that has more than 2
> sections should have a TOC. Is there a way to do it ?

Sadly no, it's hardcoded in Parser.php.

# if there are fewer than 4 headlines in the article, do not show TOC
# unless it's been explicitly enabled.
$enoughToc = $this->mShowToc &&
	( ( $numMatches >= 4 ) || $this->mForceTocPosition );

Bartosz Dziewoński

More information about the MediaWiki-l mailing list