fix: color Markdown heading markers with heading text

This commit is contained in:
2026-10-09 22:52:07 +02:00
parent d418d670ee
commit fcfdc6516d
3 changed files with 40 additions and 1 deletions
+19 -1
View File
@@ -46,6 +46,24 @@ static CPP_HIGHLIGHTS: LazyLock<String> = LazyLock::new(|| {
]
.join("\n")
});
static MD_HIGHLIGHTS: LazyLock<String> = LazyLock::new(|| {
[
tree_sitter_md::HIGHLIGHT_QUERY_BLOCK,
"
[
(atx_h1_marker)
(atx_h2_marker)
(atx_h3_marker)
(atx_h4_marker)
(atx_h5_marker)
(atx_h6_marker)
(setext_h1_underline)
(setext_h2_underline)
] @text.title
",
]
.join("\n")
});
// The MIT-licensed upstream C++ crate bundles, but does not export, injections.scm.
// This minimal AST query uses its raw-string delimiter/content nodes:
@@ -129,7 +147,7 @@ static LANGUAGES: LazyLock<[LanguageSpec; 18]> = LazyLock::new(|| {
spec(
"Markdown",
tree_sitter_md::LANGUAGE.into(),
tree_sitter_md::HIGHLIGHT_QUERY_BLOCK,
MD_HIGHLIGHTS.as_str(),
tree_sitter_md::INJECTION_QUERY_BLOCK,
"",
),