From 5643291268b4fcc081956de4caf29f625181eebb Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 25 Nov 2025 13:22:16 +0100 Subject: [PATCH] Add support for Zensical documentation tool --- src/constants.js | 1 + src/defaults.css | 5 +++++ src/utils.js | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/constants.js b/src/constants.js index 06899eb7..d81a69bd 100644 --- a/src/constants.js +++ b/src/constants.js @@ -2,6 +2,7 @@ export const SPHINX = "sphinx"; export const MKDOCS = "mkdocs"; export const MKDOCS_MATERIAL = "mkdocs-material"; +export const ZENSICAL = "zensical"; export const DOCUSAURUS = "docusaurus"; export const PELICAN = "pelican"; export const ASCIIDOCTOR = "asciidoctor"; diff --git a/src/defaults.css b/src/defaults.css index 5d6b68e5..42d58205 100644 --- a/src/defaults.css +++ b/src/defaults.css @@ -10,6 +10,11 @@ --readthedocs-filetreediff-icon-width: 0.6rem; } + :root[data-readthedocs-tool="zensical"] { + --readthedocs-font-size: 1.455em; + --readthedocs-filetreediff-icon-width: 0.6rem; + } + :root[data-readthedocs-tool="antora"] { --readthedocs-flyout-font-size: 0.7em; --readthedocs-notification-font-size: 0.75em; diff --git a/src/utils.js b/src/utils.js index 41aac264..3f239ae1 100644 --- a/src/utils.js +++ b/src/utils.js @@ -9,6 +9,7 @@ import { MDBOOK, MKDOCS, MKDOCS_MATERIAL, + ZENSICAL, DOCUSAURUS, PELICAN, ASCIIDOCTOR, @@ -400,6 +401,7 @@ export class DocumentationTool { [ASCIIDOCTOR]: "div#content", [PELICAN]: "article", [DOCUSAURUS]: "article div.markdown", + [ZENSICAL]: "article", [ANTORA]: "article", [JEKYLL]: "article", [FALLBACK_DOCTOOL]: ["article", "main", "div.body", "div.document", "body"], @@ -557,6 +559,10 @@ export class DocumentationTool { return DOCUSAURUS; } + if (this.isZensical()) { + return ZENSICAL; + } + if (this.isAsciiDoctor()) { return ASCIIDOCTOR; } @@ -715,6 +721,10 @@ export class DocumentationTool { return this.isDocusaurusTheme(); } + isZensical() { + return this.isZensicalTheme(); + } + isPelican() { if ( document.querySelectorAll('meta[name="generator"][content="Pelican"]') @@ -839,6 +849,16 @@ export class DocumentationTool { } return false; } + + isZensicalTheme() { + if ( + document.querySelectorAll('meta[name="generator"][content*="zensical"]') + .length === 1 + ) { + return true; + } + return false; + } } export const docTool = new DocumentationTool();