DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:numbered_headings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:numbered_headings [2018-01-31 12:06] – fixed new code luh216tips:numbered_headings [2021-09-03 12:11] (current) – [Alternative] gerardnico
Line 98: Line 98:
 I use several ''h1''s in my wiki so it doesn't "steal" one level from my TOC. I use the first ''h1'' as the title of the page which I don't want to be numbered. I use several ''h1''s in my wiki so it doesn't "steal" one level from my TOC. I use the first ''h1'' as the title of the page which I don't want to be numbered.
 ==== Drawbacks ==== ==== Drawbacks ====
-  * If you have only one ''h1'' and use ''h2'', it will be numbered ''0.1''+  * If you have only one ''h1'' and use ''h2'', it will be numbered ''0.1'' in the document and not numbered at all in the TOC 
 + 
 +In this case, you may use this variant of the CSS file (tested on Bootstrap3 theme) 
 +<file css userstyle.css> 
 +.dokuwiki .page {counter-reset: level1;} 
 +.dokuwiki #dw__toc:before, 
 +.dokuwiki #dw__toc:after {counter-reset: level1; content: "";
 +.dokuwiki #dw__toc h3:before{content: ""
 +  
 +.dokuwiki .page h1, .toc-body ul.toc li.level1 {counter-reset: level2;} 
 +.dokuwiki .page h2, .toc-body ul.toc li.level2 {counter-reset: level3;} 
 +.dokuwiki .page h3, .toc-body ul.toc li.level3 {counter-reset: level4;} 
 +.dokuwiki .page h4, .toc-body ul.toc li.level4 {counter-reset: level5;} 
 +.dokuwiki .page h5, .toc-body ul.toc li.level5 {} 
 +  
 +.dokuwiki .page h1:before, 
 +.dokuwiki ul.toc li.level1 a:before { 
 +    content: counter(level1) ". "; 
 +    counter-increment: level1; 
 +
 +.dokuwiki .page h1.sectionedit1:before, 
 +.dokuwiki ul.toc li.level1 a:before { 
 +    content: none; 
 +
 +.dokuwiki .page h2:before, 
 +.dokuwiki ul.toc li.level2 a:before { 
 +    content: counter(level2) ". "; 
 +    counter-increment: level2; 
 +
 +.dokuwiki .page h3:before, 
 +.dokuwiki ul.toc li.level3 a:before { 
 +    content: counter(level2) "." counter(level3) ". "; 
 +    counter-increment: level3; 
 +
 +.dokuwiki .page h4:before, 
 +.dokuwiki ul.toc li.level4 a:before { 
 +    content: counter(level2) "." counter(level3) "." counter(level4) ". "; 
 +    counter-increment: level4; 
 +
 +.dokuwiki .page h5:before, 
 +.dokuwiki ul.toc li.level5 a:before { 
 +    content: counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) ". "; 
 +    counter-increment: level5; 
 +
 +</file>
 ==== Alternative ==== ==== Alternative ====
 This may have been better achieved by using the [[plugin:pagetitle|PageTitle Plugin]] and the original style here, but then I would have to manually rename each page of my wiki. This may have been better achieved by using the [[plugin:pagetitle|PageTitle Plugin]] and the original style here, but then I would have to manually rename each page of my wiki.
 +
 +The [[plugin:combo|combo plugin]] used also a CSS approach with [[https://combostrap.com/docs/navigation/outline#numbering|configuration]]
tips/numbered_headings.1517396807.txt.gz · Last modified: 2018-01-31 12:06 by luh216

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki