Project

General

Profile

Numbered headers, anyone?

Added by Boaz Rymland over 10 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 (7)

RE: Numbered headers, anyone? - Added by Martin Denizet (redmine.org team member) over 10 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 10 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:

RE: Numbered headers, anyone? - Added by Leandro Guida about 10 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 over 7 years 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;
}

RE: Numbered headers, anyone? - Added by Hans Kaiser almost 4 years ago

for me it was not fully clear what is needed to do here. Found this Redmine Wiki numbered headings post, which helped me to understand how to solve it. Hope it helps others too

    (1-7/7)