Skip to content

Commit adb9fa3

Browse files
authored
Add support for Zensical documentation tool (#654)
Update some values to support Zensical properly. Note that dark mode detection is not supported -- they use a pretty custom pattern: `data-md-color-scheme="slate"` for dark mode and `data-md-color-scheme="default"`. We can talk more about that later. ### Search <img width="904" height="400" alt="Screenshot_2025-11-26_10-54-18" src="https://github.com/user-attachments/assets/163fc175-3e2e-48fc-889c-8caabacb05b6" /> ### Flyout <img width="777" height="607" alt="Screenshot_2025-11-26_10-54-27" src="https://github.com/user-attachments/assets/aba1c44f-2673-4b6e-985e-61b1d925abd6" /> ### Notification <img width="847" height="204" alt="Screenshot_2025-11-26_10-54-33" src="https://github.com/user-attachments/assets/38d04cbd-734d-41f2-94ef-51fb555d7c87" />
1 parent 7d544e7 commit adb9fa3

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
export const SPHINX = "sphinx";
33
export const MKDOCS = "mkdocs";
44
export const MKDOCS_MATERIAL = "mkdocs-material";
5+
export const ZENSICAL = "zensical";
56
export const DOCUSAURUS = "docusaurus";
67
export const PELICAN = "pelican";
78
export const ASCIIDOCTOR = "asciidoctor";

src/defaults.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
--readthedocs-filetreediff-icon-width: 0.6rem;
1111
}
1212

13+
:root[data-readthedocs-tool="zensical"] {
14+
--readthedocs-font-size: 1.455em;
15+
--readthedocs-filetreediff-icon-width: 0.6rem;
16+
}
17+
1318
:root[data-readthedocs-tool="antora"] {
1419
--readthedocs-flyout-font-size: 0.7em;
1520
--readthedocs-notification-font-size: 0.75em;

src/utils.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
MDBOOK,
1010
MKDOCS,
1111
MKDOCS_MATERIAL,
12+
ZENSICAL,
1213
DOCUSAURUS,
1314
PELICAN,
1415
ASCIIDOCTOR,
@@ -400,6 +401,7 @@ export class DocumentationTool {
400401
[ASCIIDOCTOR]: "div#content",
401402
[PELICAN]: "article",
402403
[DOCUSAURUS]: "article div.markdown",
404+
[ZENSICAL]: "article",
403405
[ANTORA]: "article",
404406
[JEKYLL]: "article",
405407
[FALLBACK_DOCTOOL]: ["article", "main", "div.body", "div.document", "body"],
@@ -557,6 +559,10 @@ export class DocumentationTool {
557559
return DOCUSAURUS;
558560
}
559561

562+
if (this.isZensical()) {
563+
return ZENSICAL;
564+
}
565+
560566
if (this.isAsciiDoctor()) {
561567
return ASCIIDOCTOR;
562568
}
@@ -715,6 +721,10 @@ export class DocumentationTool {
715721
return this.isDocusaurusTheme();
716722
}
717723

724+
isZensical() {
725+
return this.isZensicalTheme();
726+
}
727+
718728
isPelican() {
719729
if (
720730
document.querySelectorAll('meta[name="generator"][content="Pelican"]')
@@ -839,6 +849,16 @@ export class DocumentationTool {
839849
}
840850
return false;
841851
}
852+
853+
isZensicalTheme() {
854+
if (
855+
document.querySelectorAll('meta[name="generator"][content*="zensical"]')
856+
.length === 1
857+
) {
858+
return true;
859+
}
860+
return false;
861+
}
842862
}
843863

844864
export const docTool = new DocumentationTool();

0 commit comments

Comments
 (0)