Skip to content

Commit

Permalink
fix: syntax-highlight (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyboard-slayer committed Sep 29, 2024
1 parent eb514a2 commit 5d8c2be
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion meta/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(""))

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"""
<!DOCTYPE html>
<html lang="en">
Expand Down

0 comments on commit 5d8c2be

Please sign in to comment.