Start installation guide in the docs

This commit is contained in:
Thomas Sileo 2022-07-05 09:15:45 +02:00
parent 1f6d6c5477
commit 51f920bc4d
6 changed files with 157 additions and 7 deletions

View file

@ -1,3 +1,4 @@
import shutil
from pathlib import Path
from jinja2 import Environment
@ -9,7 +10,7 @@ from app.config import VERSION
def markdownify(content: str) -> str:
return markdown(content, extensions=["mdx_linkify"])
return markdown(content, extensions=["mdx_linkify", "fenced_code", "codehilite"])
def main() -> None:
@ -18,7 +19,10 @@ def main() -> None:
env = Environment(loader=loader, autoescape=select_autoescape())
template = env.get_template("layout.html")
shutil.rmtree("docs/dist", ignore_errors=True)
Path("docs/dist").mkdir(exist_ok=True)
shutil.rmtree("docs/dist/static", ignore_errors=True)
shutil.copytree("docs/static", "docs/dist/static")
readme = Path("README.md")
template.stream(
@ -26,6 +30,12 @@ def main() -> None:
version=VERSION,
).dump("docs/dist/index.html")
install = Path("docs/install.md")
template.stream(
content=markdownify(install.read_text().removeprefix("# microblog.pub")),
version=VERSION,
).dump("docs/dist/installing.html")
if __name__ == "__main__":
main()