1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
h1 {
/* must reset here */
counter-reset: chapter {{ page.chapter }};
}
h1:before {
/* and must reset again here */
counter-reset: chapter {{ page.chapter }};
content: "Chapter " counter(chapter);
display: block;
}
h2 {
/* must increment here */
counter-increment: section;
counter-reset: subsection;
}
h2:before {
/* and must reset again here */
counter-reset: chapter {{ page.chapter }};
content: counter(chapter) "." counter(section) ;
display: inline;
margin-right: 1em;
}
h2:after {
/* can only have one counter-reset per tag, so can't do it in h2/h2:before... */
counter-reset: example;
}
h3 {
/* must increment here */
counter-increment: subsection;
}
h3:before {
/* and must reset again here */
counter-reset: chapter {{ page.chapter }};
content: counter(chapter) "." counter(section) "." counter(subsection);
display: inline;
margin-right: 1em;
}
h3[id*='example'] {
/* must increment here */
counter-increment: example;
display: inline;
}
h3[id*='example']:before {
/* and must reset again here */
counter-reset: chapter {{ page.chapter }};
content: "Example " counter(chapter) "." counter(section) "." counter(example);
display: inline;
margin-right: 1em;
}
.no-numbering, .no-numbering:before, .no-numbering:after {
content: normal;
counter-reset: none;
counter-increment: none;
}
|