Repository navigation
Highlight Mermaid fences in the editor - #10
Conversation
@codemirror/language-data ships no Mermaid grammar, so ```mermaid fences were plain text. Add a small stream tokenizer covering diagram keywords, arrows, node and edge labels, messages, comments, directives and style lines, loaded lazily with the first Mermaid fence. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015T2MmivwEhojpAYHAyCvtQ
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to No actionable issue remains from the reviewed changes; the PR is mergeable after normal checks. Pre-merge checks |
|
|
🚀 Preview Deployment Ready!
|
Requested by Adi · project thread
Before: code inside a
```mermaidfence in the editor was plain text, while```tsand other fences were highlighted.After: Mermaid fences (and
```mmd) are highlighted with the editor's existing palette: diagram types and keywords in purple, directions and numbers in orange, node labels, edge labels and messages in green, arrows in proof red, comments in italic grey,%%{init}%%directives muted, andclassDef/stylelines with property names and colors picked out.@codemirror/language-dataships no Mermaid grammar, so this adds a small stream tokenizer (src/features/editor/mermaid.ts) that covers what every diagram type shares rather than a full grammar per diagram type.How: the tokenizer is registered as a
LanguageDescriptionahead oflanguagesincodeLanguages, and is loaded lazily with the first Mermaid fence. Arrows get their own tag (t.special(t.operator)), so operators in other languages are unchanged. The preview never shows Mermaid source as code (it renders the diagram), so nothing changes there. Tests inmermaid.test.tscover flowcharts, sequence messages, arrows across diagram types, comments, directives, style lines and pie values.🤖 Generated with Claude Code
https://claude.ai/code/session_015T2MmivwEhojpAYHAyCvtQ
Generated by Claude Code
Summary by CodeRabbit
mermaidandmmdlanguage tags.