ids theme: automatic chapter numbering, ported from gdoc2reveal
Chapter headings (#) are numbered automatically when the presentation is
opened: "1. Introduction", "2. Methods", and so on. References, appendix
and thank-you chapters keep their bare titles and are not counted.
Manually typed leading numbers ("# 2. Methods") are stripped before
renumbering, so decks migrated from the old Google Docs pipeline and
repeated numbering runs stay stable.
The menu plugin and the transcript view show the numbers, too; the
Overview slide's table of contents prepends them as orange
.ids-toc-number spans flush with the slide heading, with the theme's
drawn list markers suppressed for the top-level entries (sub-headings
keep their bullets). Decks rendered with slide_level: 1 are left
unnumbered -- there, headings denote slides, not chapters.
Bump version to 0.9.1.9010.
Change-Id: I233086e039aee0da156cfaaebe04d05f3ad851ce
diff --git a/inst/reveal.js-5.2.1/css/theme/source/ids.scss b/inst/reveal.js-5.2.1/css/theme/source/ids.scss
index e0a7634..e833b8f 100644
--- a/inst/reveal.js-5.2.1/css/theme/source/ids.scss
+++ b/inst/reveal.js-5.2.1/css/theme/source/ids.scss
@@ -202,11 +202,17 @@
// Ordered lists: the CSS list-item counter honours the HTML start/value
// attributes, so pandoc's `start`/`value` lists keep their numbers. Numbers
-// are right-aligned into the indent, ending just before the item text.
+// are anchored with their right edge $idsNumberGap away from the item text
+// (a shrink-to-fit box; anchoring from the right instead of a fixed-width,
+// right-aligned box, because over-wide numbers would otherwise overflow
+// INTO the text). Longer numbers like "10." grow to the left.
+$idsNumberGap: 0.3em;
+
.reveal .slides section:not(.title-frame) ol > li::before {
content: counter(list-item, decimal) "." !important;
- width: calc(#{$idsListIndent} - 0.12em) !important;
- text-align: right !important;
+ left: auto !important;
+ right: 100% !important;
+ margin-right: $idsNumberGap !important;
}
// Checkbox (pandoc task) lists keep their checkboxes, no markers on top.
@@ -1124,9 +1130,23 @@
/*********************************************
* OVERVIEW / TOC SLIDES
*********************************************/
-/* Entries stay at the normal slide body size and keep the theme's link
- colour, so they read as the navigation links they are. Only the denser
- two-column variant with sub-headings is scaled down. */
+/* The auto-generated TOC lists the chapters with their numbers as
+ .ids-toc-number spans in the marker colour, prepended to the entry
+ titles: the enumeration therefore starts flush with the slide heading
+ (the drawn ol/ul markers are suppressed for the top-level entries;
+ sub-headings below their chapters keep their bullets). Entries stay at
+ the normal slide body size and keep the theme's link colour, so they
+ read as the navigation links they are. Only the denser two-column
+ variant with sub-headings is scaled down. */
+.reveal .slides section:not(.title-frame) .ids-overview-toc {
+ padding-left: 0 !important;
+}
+.reveal .slides section:not(.title-frame) .ids-overview-toc > li::before {
+ content: none !important;
+}
+.reveal .ids-overview-toc .ids-toc-number {
+ color: var(--r-list-bullet-color);
+}
.reveal .ids-overview-toc {
list-style: none;
margin: 0.2em 0 0 0;
diff --git a/inst/reveal.js-5.2.1/dist/theme/ids.css b/inst/reveal.js-5.2.1/dist/theme/ids.css
index 43fe710..dd54e86 100644
--- a/inst/reveal.js-5.2.1/dist/theme/ids.css
+++ b/inst/reveal.js-5.2.1/dist/theme/ids.css
@@ -415,8 +415,9 @@
.reveal .slides section:not(.title-frame) ol > li::before {
content: counter(list-item, decimal) "." !important;
- width: calc(0.65em - 0.12em) !important;
- text-align: right !important;
+ left: auto !important;
+ right: 100% !important;
+ margin-right: 0.3em !important;
}
.reveal .slides section:not(.title-frame) ul.task-list li::before {
@@ -1146,9 +1147,26 @@
/*********************************************
* OVERVIEW / TOC SLIDES
*********************************************/
-/* Entries stay at the normal slide body size and keep the theme's link
- colour, so they read as the navigation links they are. Only the denser
- two-column variant with sub-headings is scaled down. */
+/* The auto-generated TOC lists the chapters with their numbers as
+ .ids-toc-number spans in the marker colour, prepended to the entry
+ titles: the enumeration therefore starts flush with the slide heading
+ (the drawn ol/ul markers are suppressed for the top-level entries;
+ sub-headings below their chapters keep their bullets). Entries stay at
+ the normal slide body size and keep the theme's link colour, so they
+ read as the navigation links they are. Only the denser two-column
+ variant with sub-headings is scaled down. */
+.reveal .slides section:not(.title-frame) .ids-overview-toc {
+ padding-left: 0 !important;
+}
+
+.reveal .slides section:not(.title-frame) .ids-overview-toc > li::before {
+ content: none !important;
+}
+
+.reveal .ids-overview-toc .ids-toc-number {
+ color: var(--r-list-bullet-color);
+}
+
.reveal .ids-overview-toc {
list-style: none;
margin: 0.2em 0 0 0;