Add Specs section, Reflexive Web essay, fix highlight and dev caching
- Fix highlight() returning SxExpr so syntax-highlighted code renders as DOM elements instead of leaking SX source text into the page - Add Specs section that reads and displays canonical SX spec files from shared/sx/ref/ with syntax highlighting - Add "The Reflexive Web" essay on SX becoming a complete LISP with AI as native participant - Change logo from (<x>) to (<sx>) everywhere - Unify all backgrounds to bg-stone-100, center code blocks - Skip component/style cookie cache in dev mode so .sx edits are visible immediately on refresh without clearing localStorage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -236,14 +236,15 @@ def _tokenize_bash(code: str) -> list[tuple[str, str]]:
|
||||
return tokens
|
||||
|
||||
|
||||
def highlight(code: str, language: str = "lisp") -> str:
|
||||
"""Highlight code in the given language. Returns sx source."""
|
||||
def highlight(code: str, language: str = "lisp"):
|
||||
"""Highlight code in the given language. Returns SxExpr for wire format."""
|
||||
from shared.sx.parser import SxExpr
|
||||
if language in ("lisp", "sx", "sexp"):
|
||||
return highlight_sx(code)
|
||||
return SxExpr(highlight_sx(code))
|
||||
elif language in ("python", "py"):
|
||||
return highlight_python(code)
|
||||
return SxExpr(highlight_python(code))
|
||||
elif language in ("bash", "sh", "shell"):
|
||||
return highlight_bash(code)
|
||||
return SxExpr(highlight_bash(code))
|
||||
# Fallback: no highlighting, just escaped text
|
||||
escaped = code.replace("\\", "\\\\").replace('"', '\\"')
|
||||
return f'(span "{escaped}")'
|
||||
return SxExpr(f'(span "{escaped}")')
|
||||
|
||||
Reference in New Issue
Block a user