Skip to content

Commit

Permalink
馃摎 DOCS: Improve CSS (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Jan 15, 2023
1 parent 9d1869d commit 2764cd2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/_static/local.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ span.label {
/* pyscript changes this and it messes up footnote labels */
all: unset;
}

.tippy-box {
background-color:var(--pst-color-surface);
color:var(--pst-color-text-base);
border: 1px solid var(--pst-color-border);
}
12 changes: 11 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = ["local.css"]

rediraffe_redirects = {
"using/intro.md": "sphinx/intro.md",
Expand Down Expand Up @@ -190,9 +191,18 @@ def setup(app: Sphinx):
MystWarningsDirective,
)

app.add_css_file("local.css")
app.add_directive("myst-config", MystConfigDirective)
app.add_directive("docutils-cli-help", DocutilsCliHelpDirective)
app.add_directive("doc-directive", DirectiveDoc)
app.add_directive("myst-warnings", MystWarningsDirective)
app.add_post_transform(StripUnsupportedLatex)
app.connect("html-page-context", add_version_to_css)


def add_version_to_css(app, pagename, templatename, context, doctree):
"""Add the version number to the local.css file, to bust the cache for changes."""
if app.builder.name != "html":
return
if "_static/local.css" in context.get("css_files", {}):
index = context["css_files"].index("_static/local.css")
context["css_files"][index] = f"_static/local.css?v={__version__}"

0 comments on commit 2764cd2

Please sign in to comment.