mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 07:38:00 +00:00
Add Fathom to docs
This commit is contained in:
parent
1eb331143d
commit
f432ce291a
3 changed files with 13 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,6 +3,7 @@
|
||||||
resources/test/cpython
|
resources/test/cpython
|
||||||
docs/
|
docs/
|
||||||
mkdocs.yml
|
mkdocs.yml
|
||||||
|
.overrides
|
||||||
|
|
||||||
###
|
###
|
||||||
# Rust.gitignore
|
# Rust.gitignore
|
||||||
|
|
|
@ -23,6 +23,7 @@ theme:
|
||||||
toggle:
|
toggle:
|
||||||
icon: material/weather-night
|
icon: material/weather-night
|
||||||
name: Switch to light mode
|
name: Switch to light mode
|
||||||
|
custom_dir: .overrides
|
||||||
repo_url: https://github.com/charliermarsh/ruff
|
repo_url: https://github.com/charliermarsh/ruff
|
||||||
repo_name: ruff
|
repo_name: ruff
|
||||||
site_author: charliermarsh
|
site_author: charliermarsh
|
||||||
|
|
|
@ -19,6 +19,11 @@ DOCUMENTATION_LINK: str = (
|
||||||
"This README is also available as [documentation](https://beta.ruff.rs/docs/)."
|
"This README is also available as [documentation](https://beta.ruff.rs/docs/)."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
FATHOM_SCRIPT: str = (
|
||||||
|
'<script src="https://cdn.usefathom.com/script.js" data-site="DUAEBFLB" defer>'
|
||||||
|
"</script>"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
"""Generate an MkDocs-compatible `docs` and `mkdocs.yml`."""
|
"""Generate an MkDocs-compatible `docs` and `mkdocs.yml`."""
|
||||||
|
@ -34,7 +39,7 @@ def main() -> None:
|
||||||
Path("docs").mkdir(parents=True, exist_ok=True)
|
Path("docs").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Split the README.md into sections.
|
# Split the README.md into sections.
|
||||||
for (title, filename) in SECTIONS:
|
for title, filename in SECTIONS:
|
||||||
with Path(f"docs/{filename}").open("w+") as f:
|
with Path(f"docs/{filename}").open("w+") as f:
|
||||||
block = content.split(f"<!-- Begin section: {title} -->")
|
block = content.split(f"<!-- Begin section: {title} -->")
|
||||||
if len(block) != 2:
|
if len(block) != 2:
|
||||||
|
@ -64,6 +69,11 @@ def main() -> None:
|
||||||
{"FAQ": "faq.md"},
|
{"FAQ": "faq.md"},
|
||||||
{"Contributing": "contributing.md"},
|
{"Contributing": "contributing.md"},
|
||||||
]
|
]
|
||||||
|
config["extra"] = {"analytics": {"provider": "fathom"}}
|
||||||
|
|
||||||
|
Path(".overrides/partials/integrations/analytics").mkdir(parents=True, exist_ok=True)
|
||||||
|
with Path(".overrides/partials/integrations/analytics/fathom.html").open("w+") as fp:
|
||||||
|
fp.write(FATHOM_SCRIPT)
|
||||||
|
|
||||||
with Path("mkdocs.yml").open("w+") as fp:
|
with Path("mkdocs.yml").open("w+") as fp:
|
||||||
yaml.safe_dump(config, fp)
|
yaml.safe_dump(config, fp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue