feat: enable Prism syntax highlighting in code blocks

- Register CodeHighlightNode in the editor node set
- Add CodeHighlightPlugin that calls registerCodeHighlighting
- Map 20+ Prism token types to mc-tok-* CSS classes with dark theme colors
- Explicitly import prismjs + language components and set globalThis.Prism
  before @lexical/code-prism loads, fixing a Vite dev-mode race where
  the CJS shim could initialize the tokenizer before the global was set
- Added @types/prismjs for type checking

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-25 19:52:54 +01:00
co-authored by Copilot
parent 8240468d1e
commit 860876172e
3 changed files with 29 additions and 1 deletions
+1
View File
@@ -34,6 +34,7 @@
"@lexical/headless": "0.42.0",
"@tailwindcss/vite": "^4.2.2",
"@types/node": "^25.5.0",
"@types/prismjs": "^1.26.6",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "5.1.0",