Numbering ordered lists: Difference between revisions

No edit summary
Tag: 2017 source edit
No edit summary
Line 5: Line 5:
/* Styles for formatting sub-ordered-list-items with 1.1., 1.1.1., etc.)*/
/* Styles for formatting sub-ordered-list-items with 1.1., 1.1.1., etc.)*/
/* First, set all numbered lists to use coSub-reset */
/* First, set all numbered lists to use counter-reset */
#mw-content-text ol, ol.ve-ce-branchNode {
#mw-content-text ol, ol.ve-ce-branchNode {
       coSub-reset: item;
       counter-reset: item;
       margin: 0.3em 0 0 2.2em;
       margin: 0.3em 0 0 2.2em;
}
}
Line 17: Line 17:
ol.ve-ce-branchNode>li > p {display:inline}
ol.ve-ce-branchNode>li > p {display:inline}


/* Use a coSub that checks the number of items and adds a "." between them and ends with ". " */
/* Use a counter that checks the number of items and adds a "." between them and ends with ". " */
#mw-content-text ol>li:before, ol.ve-ce-branchNode>li:before {  
#mw-content-text ol>li:before, ol.ve-ce-branchNode>li:before {  
       content: coSubs(item, ".") ". ";  
       content: counters(item, ".") ". ";  
       coSub-increment: item;
       counter-increment: item;
}
}



Revision as of 13:14, 17 July 2024

To number bullets in the page text consecutively, you can add the following CSS to the page MediaWiki:Common.css. Please note that this custom styling may not work if it is incompatible with CSS declarations from other stylesheets in the wiki.

Important!This styling does NOT apply in the PDF export.


/* Styles for formatting sub-ordered-list-items with 1.1., 1.1.1., etc.)*/
	
/* First, set all numbered lists to use counter-reset */
#mw-content-text ol, ol.ve-ce-branchNode {
      counter-reset: item;
       margin: 0.3em 0 0 2.2em;
}

/* Display all list items in a numbered list in block display */
#mw-content-text ol>li, ol.ve-ce-branchNode>li {
      display: block;
}
ol.ve-ce-branchNode>li > p {display:inline}

/* Use a counter that checks the number of items and adds a "." between them and ends with ". " */
#mw-content-text ol>li:before, ol.ve-ce-branchNode>li:before { 
      content: counters(item, ".") ". "; 
      counter-increment: item;
}

/*Number footnotes separately */
#mw-content-text  .references ::marker {
    content: " ";	
}
#mw-content-text  ol.references {
    counter-reset:ref; list-style-type:none;
}
#mw-content-text  ol.references li:before{
    counter-increment:ref;
    content:counter(ref) ". ";
    float: left;
    margin-right: 1em;
	}
#mw-content-text  ol > li li {
    margin-left:-0.3em;
}

Output:

  1. Step 1
    1. Substep 1
    2. Substep 2
      1. SubSubstep 1
      2. SubSubstep 2
      3. SubSubstep 3
  2. Step 2
  3. Step 2
  4. Step 2

Bulleted lists that are not numbered are not affected by the CSS declarations:

  • List item
    • List item level 2
      • List item level 3

Numbering in a new "ordered list" starts back at 1:

  1. Step 1
    1. Substep 1
    2. Substep 2
      1. SubSubstep 1
      2. SubSubstep 2
      3. SubSubstep 3
  2. Step 2
  3. Step 2
  4. Step 2



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