How do I configure mediawiki to show heading numbering/lettering in the document?

7

1

When the table of contents is generated, it numbers sections based upon their heading:

1. section 1  
2. section 2  
2.1 section 2.1  
2.2 section 2.2  
3. section 3

I would like these section numbers to appear at the paragraph level as well:

1. (section 1 header text)
... section 1 content ...

2. (section 2 header text)
... section 2 content ....

Any tips?

Brian Webster

Posted 2010-04-14T19:47:30.010

Reputation: 1 555

Answers

4

There is a user-preference to make all headings use outline numbering, but no way to make that a default for all users. Here's a few lines of code which can be added to your LocalSettings.php file which do that.

$wgExtensionFunctions[] = 'wfNumberHeadings';
function wfNumberHeadings() {
    global $wgUser;
    $wgUser->setOption('numberheadings', true);
}

two7s_clash

Posted 2010-04-14T19:47:30.010

Reputation: 194

It's been 6 years since the answer. Is there a new way how to make the extentions working globally? – Amio.io – 2016-08-22T06:27:11.027

This works great for permanently disabling header numbering on pages (while maintaining TOC numbering). However the User Preference "Auto number headings" is now useless. Can we remove that user-pref option somehow? Or is it possible to just edit all existing and new user's prefs to set numberheadings = false but then they can still reenable it if desired? – Demis – 2017-11-28T20:53:55.857

3

According to this page, you can also change in LocalSettings.php to make this behavior the default.

$wgDefaultUserOptions['numberheadings'] = 1;

Satri

Posted 2010-04-14T19:47:30.010

Reputation: 31

This didn't make any visible difference on my wiki. Perhaps this only works for users created after you add this line - then their 'default' setting will be to not show numbers - ok if you have a brand new wiki. Would also need a command to apply the setting to all existing users (eg. via MySQL?). – Demis – 2017-11-28T20:55:11.133

0

I found that this extension was the best way to go: https://www.mediawiki.org/wiki/Extension:NumberedHeadings

Also, the OP wants to number your paragraph levels as well - I'd say just make all paragraphs actually SubHeading#5 and use CSS to make it look ho

Demis

Posted 2010-04-14T19:47:30.010

Reputation: 266