Numbered headers, anyone?

Added by Boaz Rymland over 3 years ago

Hi,

Is there a way to generate numbered headers?
Example syntax :

h1. # Master heading

h2. ## Sub Heading 1

h1. # Another important heading

Will be rendered as:

1. Master heading

1.1 Sub heading 1

2. Another important heading

I've seen such questions on the web, but without solutions.
TIA!
Boaz.

Replies (6)

RE: Numbered headers, anyone? - Added by Martin Denizet (redmine.org team member) over 3 years ago

Hello Boaz ,

Try:

h1. 
# Master heading

Note that there is a space after the h1.

Cheers,

RE: Numbered headers, anyone? - Added by Boaz Rymland over 3 years ago

Thanks, but its not working. I've tried:

Welcome to Wiki!

h1. 
# Master heading

h2. 
## Sub heading

h2. 
## Another heading

h1. 
# Next first level

h2. 
# Confusing numbering symbol

and its being rendered as shown in the image below:

headers.png (14.2 KB)

RE: Numbered headers, anyone? - Added by Leandro Guida about 3 years ago

Is there a way of doing this? It would be very useful!

Right now all my Wikis are numbered by hand =/

RE: Numbered headers, anyone? - Added by Guillaume Storchi 5 months ago

/*Numering header in wiki*/

div.wiki, div.wiki-page {
  counter-reset:h1s;
}

.wiki h1 {
    counter-reset: h2s;
}
.wiki h1::before {
    content: counter(h1s) ". ";
    counter-increment: h1s;
}
.wiki h2 {
   counter-reset: h3s;
}
.wiki h2::before {
    content: counter(h1s) "." counter(h2s) ". ";
    counter-increment: h2s;
}
.wiki h3 {
   counter-reset: h4s;
}
.wiki h3::before {
    content: counter(h1s) "." counter(h2s) "." counter(h3s) ". ";
    counter-increment: h3s;
}
.wiki h4 {
    counter-reset: h5s;
}
.wiki h4::before {
    content: counter(h1s) "." counter(h2s) "." counter(h3s) "." counter(h4s);
    counter-increment: h4s;
}
.wiki h5 {
}
.wiki h5::before {
    content: counter(h1s) "." counter(h2s) "." counter(h3s) "."  counter(h4s) "." counter(h5s);
    counter-increment: h5s;
}

(1-6/6)