feat(highlight): add markdown syntax highlighting with injection

Add tree-sitter-md for markdown parsing with injection support for
fenced code blocks. Code inside markdown code fences (```rust, ```bash,
etc.) is now fully syntax highlighted.

Key fix: Use `#set! injection.include-children` directive in the
injection query to override tree-sitter-md's internal tokenization
of code_fence_content, allowing proper language injection.

- Add tree-sitter-md v0.5.2 dependency
- Add Markdown variant to Language enum (md, markdown aliases)
- Create queries/md-highlights.scm (minimal markdown highlights)
- Create queries/md-injections.scm (with include-children directive)
- Add test: test_markdown_injection_rust
This commit is contained in:
Timothy DeHerrera
2026-01-31 16:41:11 -07:00
parent 69cd81621f
commit 8c54882118
6 changed files with 92 additions and 1 deletions

11
Cargo.lock generated
View File

@@ -1531,6 +1531,7 @@ dependencies = [
"tree-sitter-html",
"tree-sitter-javascript",
"tree-sitter-json",
"tree-sitter-md",
"tree-sitter-nix",
"tree-sitter-python",
"tree-sitter-rust",
@@ -1809,6 +1810,16 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae62f7eae5eb549c71b76658648b72cc6111f2d87d24a1e31fa907f4943e3ce"
[[package]]
name = "tree-sitter-md"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c96068626225a758ddb1f7cfb82c7c1fab4e093dd3bde464e2a44e8341f58f5"
dependencies = [
"cc",
"tree-sitter-language",
]
[[package]]
name = "tree-sitter-nix"
version = "0.3.0"