Fix code blocks + add violet bg classes to tw.css

- Pass :code keyword to ~doc-code and ~example-source components
  (highlighted content was positional but components use &key code)
- Rebuild tw.css (v3.4.19) with sx/sxc and sx/content in content paths
  so highlight.py classes (text-violet-600, text-rose-600, etc.) are included
- Add bg-violet-{100-500} classes for the sx app's violet menu bar
- Add highlight.py custom syntax highlighter (sx, python, bash)

IMPORTANT: tw.css must contain bg-violet-{100-500} rules for the sx
app's menu bar. Do not rebuild tw.css without ensuring violet classes
are included (via safelist or content paths).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 01:13:01 +00:00
parent 8445c36270
commit e4e43177a8
3 changed files with 252 additions and 3 deletions

View File

@@ -25,13 +25,13 @@ def _full_page(ctx: dict, **kwargs) -> str:
def _code(code: str, language: str = "lisp") -> str:
"""Build a ~doc-code component with highlighted content."""
highlighted = highlight(code, language)
return f'(~doc-code {highlighted})'
return f'(~doc-code :code {highlighted})'
def _example_code(code: str) -> str:
"""Build an ~example-source component with highlighted content."""
highlighted = highlight(code, "lisp")
return f'(~example-source {highlighted})'
return f'(~example-source :code {highlighted})'
# ---------------------------------------------------------------------------