Skip to content

Commit

Permalink
feat: Add variables to override the initial counter value at the docu…
Browse files Browse the repository at this point in the history
…ment root

see #129
  • Loading branch information
spring-raining committed Sep 8, 2024
1 parent fc5f428 commit 18ed51a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .changeset/neat-windows-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@vivliostyle/theme-base": minor
---

Add variables to override the initial counter value at the document root.

The following CSS variables are supported:

- `--vs-crossref--root-counter-{fig|tbl|cite}`
- `--vs-footnote--root-counter-footnote`
- `--vs-section--root-counter-{sections|sec-h1|sec-h2|sec-h3|sec-h4|sec-h5|sec-h6}`
1 change: 1 addition & 0 deletions packages/@vivliostyle/theme-base/css/common/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ html {
body {
counter-reset: var(--vs-crossref--root-counter-reset,)
var(--vs-footnote--root-counter-reset,)
var(--vs-section--root-counter-reset,)
var(--vs-document-root-counter-reset,);
}

Expand Down
6 changes: 4 additions & 2 deletions packages/@vivliostyle/theme-base/css/partial/crossref.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
counter(vs-counter-tbl, var(--vs-crossref--counter-style)) ': ';
--vs-crossref--marker-cite-content: '[' counter(vs-counter-cite) ']';
--vs-crossref--marker-margin-inline: 0;
--vs-crossref--root-counter-reset: vs-counter-fig vs-counter-tbl
vs-counter-cite;
--vs-crossref--root-counter-reset: vs-counter-fig
var(--vs-crossref--root-counter-fig,) vs-counter-tbl
var(--vs-crossref--root-counter-tbl,) vs-counter-cite
var(--vs-crossref--root-counter-cite,);

/* displays dummy content on screen media that doesn't support target-counter() */
--vs-crossref--call-fig-content-on-screen: 'Figure ???';
Expand Down
3 changes: 2 additions & 1 deletion packages/@vivliostyle/theme-base/css/partial/footnote.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
--vs-footnote--area-before-margin-inline: var(--vs--hr-margin-inline);
--vs-footnote--item-margin-block: 0;
--vs-footnote--item-margin-inline: 0;
--vs-footnote--root-counter-reset: vs-counter-footnote;
--vs-footnote--root-counter-reset: vs-counter-footnote
var(--vs-footnote--root-counter-footnote,);
}

.footnote,
Expand Down
8 changes: 8 additions & 0 deletions packages/@vivliostyle/theme-base/css/partial/section.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
var(--vs-section--counter-style)
);
--vs-section--marker-margin-inline: 1ch;
--vs-section--root-counter-reset: vs-counter-sections
var(--vs-section--root-counter-sections,) vs-counter-sec-h1
var(--vs-section--root-counter-sec-h1,) vs-counter-sec-h2
var(--vs-section--root-counter-sec-h2,) vs-counter-sec-h3
var(--vs-section--root-counter-sec-h3,) vs-counter-sec-h4
var(--vs-section--root-counter-sec-h4,) vs-counter-sec-h5
var(--vs-section--root-counter-sec-h5,) vs-counter-sec-h6
var(--vs-section--root-counter-sec-h6,);
}

:lang(ja) {
Expand Down

0 comments on commit 18ed51a

Please sign in to comment.