cogDisplays numbered headings in the wiki
Developed by

Jeremie Bousquet

Active Installs132
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager


Check the Numbered Reference Macro which provides more features and is more recent.

Insert the following in your page to have the headings automatically numbered:


To extend this to the whole wiki:

  • edit objects of page Macros.NumberedHeadingsStylesheetExtensionMacro
  • navigate to the XWiki.StyleSheetExtension object
  • choose "Use this extension" : "Always" instead of "On demand"
  • Then all headings will be numbered without need of adding the {{numberedheadings/}} in each page

Sample result:


This macro was greatly inspired by this thread. Only small bits were done to adapt it to XWiki.


This macro adds the following CSS to the page where it's used:

#xwikicontent { 
    counter-reset: mynum-h1 !important; 

#xwikicontent h1 {
    counter-reset: mynum-h2 !important;

#xwikicontent h1:before {
    content: counter(mynum-h1) " " !important;
    counter-increment: mynum-h1 !important;

#xwikicontent h2 {
    counter-reset: mynum-h3 !important;

#xwikicontent h2:before {
    content: counter(mynum-h1) "." counter(mynum-h2) " " !important;
    counter-increment: mynum-h2 !important;

#xwikicontent h3 {
    counter-reset: mynum-h4 !important;

#xwikicontent h3:before {
    content: counter(mynum-h1) "." counter(mynum-h2) "." counter(mynum-h3) " " !important;
    counter-increment: mynum-h3 !important;

#xwikicontent h4 {
    counter-reset: mynum-h5 !important;

#xwikicontent h4:before {
    content: counter(mynum-h1) "." counter(mynum-h2) "." counter(mynum-h3) "." counter(mynum-h4) " " !important;
    counter-increment: mynum-h4 !important;

#xwikicontent h5 {
    counter-reset: mynum-h6 !important;

#xwikicontent h5:before {
    content: counter(mynum-h1) "." counter(mynum-h2) "." counter(mynum-h3) "." counter(mynum-h4) "." counter(mynum-h5) " " !important;
    counter-increment: mynum-h5 !important;

#xwikicontent h6 {


#xwikicontent h6:before {
    content: counter(mynum-h1) "." counter(mynum-h2) "." counter(mynum-h3) "." counter(mynum-h4) "." counter(mynum-h5) "." counter(mynum-h6) " " !important;
    counter-increment: mynum-h6 !important;

Tested on

This extension has been tested with the following configurations.

Extension VersionXWiki FlavorNotes
1.0XWiki Enterprise 3.5

Not compatible with IE6 / IE7

1.1XWiki Enterprise 6.0.1

Release Notes


bugfix : version 1.0 was not working due to badly renamed page ...


Initial release


Get Connected