Minor improvements to the docs (#2371)

This commit is contained in:
Charlie Marsh 2023-01-30 19:06:05 -05:00 committed by GitHub
parent b5816634b3
commit 69e20c4554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 13 deletions

View file

@ -15,12 +15,22 @@ SECTIONS: list[tuple[str, str]] = [
("FAQ", "faq.md"),
]
DOCUMENTATION_LINK: str = (
"This README is also available as [documentation](https://beta.ruff.rs/docs/)."
)
def main() -> None:
"""Generate an MkDocs-compatible `docs` and `mkdocs.yml`."""
with Path("README.md").open(encoding="utf8") as fp:
content = fp.read()
# Remove the documentation link, since we're _in_ the docs.
if DOCUMENTATION_LINK not in content:
msg = "README.md is not in the expected format."
raise ValueError(msg)
content = content.replace(DOCUMENTATION_LINK, "")
Path("docs").mkdir(parents=True, exist_ok=True)
# Split the README.md into sections.