Numbering section headings: Difference between revisions

No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
To number section headings, you can add the following declarations to the page ''MediaWiki:Common.css'':
To number section headings, you can add the following declarations to the page ''MediaWiki:Common.css'':
{{Textbox|boxtype=note|header=|text=The numbering created in common.css is not applied in the PDF export!|icon=yes}}<syntaxhighlight lang="text">
{{Textbox|boxtype=important|header=|text=The numbering created in common.css is not applied in the PDF export!
article {counter-reset: h2counter;}
 
article h1 {counter-reset: h2counter;}
<br/>
article h2 {counter-reset: h3counter;}
 
article #toc h2#mw-toc-heading {counter-reset: h2counter 0}
Diese Technik funktioniert nur in Wikis, die keine Bücher angelegt haben, da sonst die Nummerierung in den Seitenabschnitten der Buchseiten nicht mehr korrekt angezeigt wird.|icon=yes}}<syntaxhighlight lang="text">
article h3 {counter-reset: h4counter;}
#mw-content-text {
article h4 {counter-reset: h5counter;}
    counter-reset: h2counter;
article h5 {counter-reset: h6counter;}
}
article h2:before, article #mw-content-text h2:before {
  #mw-content-text h1 {
        content: counter(h2counter) ".\0000a0\0000a0";
    counter-reset: h2counter;
        counter-increment: h2counter;
}
     
  #mw-content-text h2 {
    }
    counter-reset: h3counter;
article #toc h2#mw-toc-heading:before {content:""}
}
article h3:before {
#mw-content-text #toc h2#mw-toc-heading {
        content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0";
    counter-reset: h2counter 0
        counter-increment: h3counter;
}
  #mw-content-text h3 {
    counter-reset: h4counter;
}
  #mw-content-text h4 {
    counter-reset: h5counter;
}
  #mw-content-text h5 {
    counter-reset: h6counter;
}
  #mw-content-text h2:before, article #mw-content-text h2:before {
    content: counter(h2counter) ".\0000a0\0000a0";
    counter-increment: h2counter;
}
#mw-content-text #toc h2#mw-toc-heading:before {
    content:""
}
  #mw-content-text h3:before {
    content: counter(h2counter) "." counter(h3counter) ".\0000a0";
    counter-increment: h3counter;
}
#mw-content-text h4:before {
    content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0";
    counter-increment: h4counter;
}
#mw-content-text h5:before {
    content: counter(h2counter) "." counter(h3counter) "." counter(h4counter)"."counter(h5counter) ".\0000a0\0000a0";
    counter-increment: h5counter;
}
#mw-content-text h6:before {
    content: counter(h2counter) "." counter(h3counter) "." counter(h4counter)"."counter(h5counter)"." counter(h6counter) ".\0000a0\0000a0";
    counter-increment: h6counter;
}   
#mw-content-text h2 {
    padding-left:1.3em;
    text-indent:-1.3em
}
#mw-content-text h3 {
    padding-left:1.8em;
    text-indent:-1.8em
}
#mw-content-text h4 {
    padding-left:2.8em;
    text-indent:-2.8em
}
#mw-content-text h5 {
    padding-left:3.4em;
    text-indent:-3.4em
}
.mw-editsection{
    position:absolute;
    padding-left:1.5em
}
#bodyContent .sectionanchors-button{
    margin:-0.8em 0 0 -1.2em;
    max-width:1em;
    font-size:0.5em
}


    }
article  h4:before {
        content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0";
        counter-increment: h4counter;
     
    }
article  h5:before {
        content: counter(h2counter) "." counter(h3counter) "." counter(h4counter)"."counter(h5counter) ".\0000a0\0000a0";
        counter-increment: h5counter;
     
    }
article  h6:before {
        content: counter(h2counter) "." counter(h3counter) "." counter(h4counter)"."counter(h5counter)"." counter(h6counter) ".\0000a0\0000a0";
        counter-increment: h6counter;
     
    }
   
/*Keine Nummerierung bei */
/*Keine Nummerierung bei */
#mw-content-text .sectionflex h2::before, #mw-content-text .sectionflex h3::before, #mw-content-text .bs-social-entity-wrapper h3::before {content:none}
#mw-content-text .sectionflex h2::before, #mw-content-text .sectionflex h3::before, #mw-content-text .bs-social-entity-wrapper h3::before {
#mw-content-text .mw-category h2::before, #mw-content-text .mw-category-generated h2::before,#mw-content-text .mw-category h3::before, #mw-content-text .mw-category-generated h3::before, #mw-content-text .bs-tag-pagetemplates h2::before{content:none}
    content:none
.ns-special #mw-content-text h2::before, .ns-special #mw-content-text h3::before {content:none;}
}
#mw-content-text .bs-tag-pagetemplates h2:before, #mw-content-text .bs-tag-pagetemplates h3::before, #mw-content-text .bs-tag-pagetemplates h6::before {content:none;}
#mw-content-text .mw-category h2::before, #mw-content-text .mw-category-generated h2::before,#mw-content-text .mw-category h3::before, #mw-content-text .mw-category-generated h3::before, #mw-content-text .bs-tag-pagetemplates h2::before{
article #glossar h2::before, article #glossar h3::before {content:none;}
    content:none
 
}
/*Move sectionAnchor */
.ns-special #mw-content-text h2::before, .ns-special #mw-content-text h3::before {
#bodyContent .sectionanchors-button{margin-left: -1.9em;}
    content:none;
}
#mw-content-text .bs-tag-pagetemplates h2:before, #mw-content-text .bs-tag-pagetemplates h3::before, #mw-content-text .bs-tag-pagetemplates h6::before {
    content:none;
}
article #glossar h2::before, article #glossar h3::before {
    content:none;
}
</syntaxhighlight>
</syntaxhighlight>
[[Category:Customizing]]
[[Category:Customizing]]
[[en:{{FULLPAGENAME}}]]
[[en:{{FULLPAGENAME}}]]
[[de:Überschriften nummerieren]]
[[de:Überschriften nummerieren]]

Latest revision as of 16:28, 19 October 2023

To number section headings, you can add the following declarations to the page MediaWiki:Common.css:

The numbering created in common.css is not applied in the PDF export!


Diese Technik funktioniert nur in Wikis, die keine Bücher angelegt haben, da sonst die Nummerierung in den Seitenabschnitten der Buchseiten nicht mehr korrekt angezeigt wird.

#mw-content-text {
    counter-reset: h2counter;
}
 #mw-content-text h1 {
    counter-reset: h2counter;
}
 #mw-content-text h2 {
    counter-reset: h3counter;
}
 #mw-content-text #toc h2#mw-toc-heading {
    counter-reset: h2counter 0
}
 #mw-content-text h3 {
    counter-reset: h4counter;
}
 #mw-content-text h4 {
    counter-reset: h5counter;
}
 #mw-content-text h5 {
    counter-reset: h6counter;
}
 #mw-content-text h2:before, article #mw-content-text h2:before {
     content: counter(h2counter) ".\0000a0\0000a0";
     counter-increment: h2counter;
}
 #mw-content-text #toc h2#mw-toc-heading:before {
    content:""
}
 #mw-content-text h3:before {
     content: counter(h2counter) "." counter(h3counter) ".\0000a0";
     counter-increment: h3counter;
}
 #mw-content-text h4:before {
     content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0";
     counter-increment: h4counter;
}
 #mw-content-text h5:before {
     content: counter(h2counter) "." counter(h3counter) "." counter(h4counter)"."counter(h5counter) ".\0000a0\0000a0";
     counter-increment: h5counter;
}
 #mw-content-text h6:before {
     content: counter(h2counter) "." counter(h3counter) "." counter(h4counter)"."counter(h5counter)"." counter(h6counter) ".\0000a0\0000a0";
     counter-increment: h6counter; 
}     
 #mw-content-text h2 {
     padding-left:1.3em;
     text-indent:-1.3em 
}
 #mw-content-text h3 {
     padding-left:1.8em;
     text-indent:-1.8em 
}
 #mw-content-text h4 {
     padding-left:2.8em;
     text-indent:-2.8em 
}
 #mw-content-text h5 {
     padding-left:3.4em;
     text-indent:-3.4em 
}
 .mw-editsection{
    position:absolute;
     padding-left:1.5em
}
 #bodyContent .sectionanchors-button{
    margin:-0.8em 0 0 -1.2em;
     max-width:1em;
     font-size:0.5em
}

/*Keine Nummerierung bei */
 #mw-content-text .sectionflex h2::before, #mw-content-text .sectionflex h3::before, #mw-content-text .bs-social-entity-wrapper h3::before {
    content:none
}
 #mw-content-text .mw-category h2::before, #mw-content-text .mw-category-generated h2::before,#mw-content-text .mw-category h3::before, #mw-content-text .mw-category-generated h3::before, #mw-content-text .bs-tag-pagetemplates h2::before{
    content:none
}
 .ns-special #mw-content-text h2::before, .ns-special #mw-content-text h3::before {
    content:none;
}
 #mw-content-text .bs-tag-pagetemplates h2:before, #mw-content-text .bs-tag-pagetemplates h3::before, #mw-content-text .bs-tag-pagetemplates h6::before {
    content:none;
}
 article #glossar h2::before, article #glossar h3::before {
    content:none;
}



To submit feedback about this documentation, visit our community forum.

Discussions