Extension:HeaderCount

The HeaderCount extension adds a simple parser function for obtaining the number of headers, or sections, in a page.

The extension is invoked with the  parser function.

Usage
Using this extension is fairly straight forward. The  function has 2 parameters: page, and level.

When the first parameter is omitted, it will use the current page.

When the second parameter is omitted, it will use 2, as in level 2 headers.