diff --git a/meta/plugins/__init__.py b/meta/plugins/__init__.py index d442fc4..8061a22 100644 --- a/meta/plugins/__init__.py +++ b/meta/plugins/__init__.py @@ -51,6 +51,7 @@ class Site(DataClassJsonMixin): favicon: str = dt.field(default="🐱") navbar: str = dt.field(default="") footer: str = dt.field(default="") + code_theme: str = dt.field(default="default") path: Path = dt.field(default=Path("")) @@ -80,7 +81,7 @@ def renderAll(self, out: Path, args: BuildArgs) -> None: style += "\n\n\n" style += readFile(styleFile) - md = markdown.Markdown(extensions=["meta", "extra"]) + md = markdown.Markdown(extensions=["codehilite", "meta", "extra"]) for file in SITE_DIR.rglob("*"): if file.is_dir() or file.suffix == ".json": continue @@ -108,6 +109,18 @@ def renderAll(self, out: Path, args: BuildArgs) -> None: else: title = self.title + style += shell.popen( + "pygmentize", + "-S", + self.code_theme, + "-f", + "html", + "-a", + ".codehilite", + "-O", + "full", + ) + htmlContent = f"""