mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-01 17:32:25 +00:00
Add Fathom to docs
This commit is contained in:
parent
1eb331143d
commit
f432ce291a
3 changed files with 13 additions and 1 deletions
|
@ -19,6 +19,11 @@ DOCUMENTATION_LINK: str = (
|
|||
"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:
|
||||
"""Generate an MkDocs-compatible `docs` and `mkdocs.yml`."""
|
||||
|
@ -34,7 +39,7 @@ def main() -> None:
|
|||
Path("docs").mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# 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:
|
||||
block = content.split(f"<!-- Begin section: {title} -->")
|
||||
if len(block) != 2:
|
||||
|
@ -64,6 +69,11 @@ def main() -> None:
|
|||
{"FAQ": "faq.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:
|
||||
yaml.safe_dump(config, fp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue