wiki:NumberedHeadlinesPlugin

Version 20 (modified by Ryan J Ollos, 12 years ago) (diff)

Show html for last two examples.

Wiki syntax for numbered headlines

Description

This plug-in provides a new TracWiki syntax for numbered headlines (h1-h6 HTML tags).

This manual is for version 0.3 from Oct 2009.

New Wiki Syntax

The wiki syntax for numbered headlines is a follows:

Instead of:
== Unnumbered Headline ==
or
== Unnumbered Headline ==#ownID

write:
## Numbered Headline ##
or
## Numbered Headline ##=ownID

You can mix both unnumbered and numbered headlines on the same wiki page. Headlines from first order (1x# on each side) to sixth order (6x# on each side) are supported. An own ID can be given by adding "=idname", which should be an valid XHTML name.

Configuration

To enable this plugin put the following into your trac.ini configuration file:

[components]
tracnumberedheadlines.* = enabled

The following options can be added to select if

  • headlines in outlines (PageOutline, TocMacro) should be numbered (#4521, #5241)
  • numbering should start at the second level (##/h2) not at the first level (#4907)

(Default values are shown)

[numberedheadlines]
numbered_outline = true
numbering_starts_at_level_two = false

Bugs/Feature Requests

Existing bugs and feature requests for NumberedHeadlinesPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from [download:numberedheadlinesplugin here].

Source

You can check out NumberedHeadlinesPlugin from here using Subversion, or browse the source with Trac.

Example

Normal Usage

The following wiki text:

= Introduction =
# Chapter 1 #
## Section 1.1 ##
### Subsection 1.1.1 ###
### Subsection 1.1.2 ###
## Section 1.2 ##
### Subsection 1.2.1 ###
=== Unnumbered ===
### Subsection 1.2.2 ###
# Chapter 2 #
## Section 2.1 ##
### SubSubsection 2.1.1 ###
#### SubSubsection 2.1.1.1 ####
##### Paragraph 2.1.1.1.1 #####
###### Subparagraph 2.1.1.1.1 ######

will be displayed like this:

Introduction

1. Chapter 1

1.1. Section 1.1

1.1.1. Subsection 1.1.1

1.1.2. Subsection 1.1.2

1.2. Section 1.2

1.2.1. Subsection 1.2.1

Unnumbered

1.2.2. Subsection 1.2.2

2. Chapter 2

2.1. Section 2.1

2.1.1. SubSubsection 2.1.1

2.1.1.1. SubSubsection 2.1.1.1

2.1.1.1.1. Paragraph 2.1.1.1.1
2.1.1.1.1.1 Subparagraph 2.1.1.1.1.1

However with the config options numbering_starts_at_level_two = true it will be displayed without the first level numbers:

Introduction

Chapter 1

1. Section 1.1

1.1. Subsection 1.1.1

1.2. Subsection 1.1.2

2. Section 1.2

2.1. Subsection 1.2.1

Unnumbered

2.2. Subsection 1.2.2

Chapter 2

1. Section 2.1

1.1. SubSubsection 2.1.1

1.1.1. SubSubsection 2.1.1.1

1.1.1.1. Paragraph 2.1.1.1.1
1.1.1.1.1 Subparagraph 2.1.1.1.1.1

User Specified Numbers

Since v0.2.1 leading zeros are ignored, which allows the use of numbered sections under an unnumbered chapter.

This feature relates to ticket #4907.

= Title =
## Section ##
## Section ##

is now displayed as:

Title

1. Section

2. Section

User Specified Numbers

Since v0.3 the numbers can be provided by the user to set or reset the counting. The number are simply written before the headline text followed by a space.

Single numbers set the value of the current level, while multiple numbers ('1.2.3.') set the values from the current level upwards. Leading numbers as part of the headline text can be protected by using a dot followed by a space ('. ') before them, e.g. '## . 99 Red Balloons ##'.

This feature relates to ticket #4907.

# First Chapter #
## First Section ##
## 5. Now Section Five  ##
## Next Section ##
## 2.5. Now Section Five in Chapter 2 ##
## Next Section ##

# Next Chapter #
## Section ##

will lead to the following:

1. First Chapter

1.1. First Section

1.5. Now Section Five

1.6. Next Section

2.5. Now Section Five in Chapter 2

2.6. Next Section

3. Next Chapter

3.1. Section

Headlines without an text but with a number will be not displayed at all (no HTML code generated), but the number is used as normal. This gives the user the possibility to change higher level heading numbers for following lower level headline without inserting empty headlines. Please note that for technical reasons there needs to be a space after the number and another one before the leading #, which makes two leading spaces.

# 1.  #
## Section ##
# 2.  #
## Section ##

will be displayed as:

1.1. Section

2.1. Section

Recent Changes

17125 by rjollos on 2018-04-14 09:09:35
TracNumberedHeadlinesPlugin 0.5: Conform to PEP8
15264 by rjollos on 2016-02-11 04:22:34
Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

10976 by rjollos on 2011-12-01 10:26:01
Added plugin revision info to webadmin page.
(more)

Author/Contributors

Author: martin_s
Maintainer: martin_s
Contributors: JoshuaH (Page Outline support, see #4521)