Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions codeview/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def page(
'<meta name=viewport content="width=device-width,initial-scale=1">'
f"<title>{html.escape(title)}</title>"
f'<link rel=stylesheet href="{get_style_href()}">'
'<link rel=icon href="/favicon.svg" type="image/svg+xml">'
f"</head><body{cls}>"
f'<aside id="side">{side}</aside>'
f'<main id="main"><div class="wrap {width}">{main}</div></main>'
Expand Down
10 changes: 10 additions & 0 deletions codeview/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,15 @@
"""


FAVICON = (
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">'
'<rect width="32" height="32" rx="7" fill="#26313d"/>'
'<g transform="translate(4 4)" fill="none" stroke="#7ba3cc" stroke-width="2.25"'
' stroke-linecap="round" stroke-linejoin="round">'
'<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></g></svg>\n'
)


def write(target: Path, content: str) -> None:
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(content, encoding="utf-8")
Expand All @@ -494,4 +503,5 @@ def build_style(out_root: Path, extra_css: str = "") -> str:
digest = hashlib.sha256(css.encode()).hexdigest()[:10]
STYLE_HREF = f"/style.{digest}.css"
write(out_root / f"style.{digest}.css", css)
write(out_root / "favicon.svg", FAVICON)
return STYLE_HREF
Loading