Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
| make | ✓ | | ✓ | |
| markdoc | ✓ | | | `markdoc-ls` |
| markdown | ✓ | | | `marksman`, `markdown-oxide` |
| markdown-rustdoc | ✓ | | | |
| markdown.inline | ✓ | | | |
| matlab | ✓ | ✓ | ✓ | |
| mermaid | ✓ | | | |
Expand Down
9 changes: 9 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,15 @@ block-comment-tokens = { start = "<!--", end = "-->" }
name = "markdown"
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-markdown", rev = "62516e8c78380e3b51d5b55727995d2c511436d8", subpath = "tree-sitter-markdown" }

[[language]]
name = "markdown-rustdoc"
scope = "source.markdown-rustdoc"
grammar = "markdown"
injection-regex = "markdown-rustdoc"
file-types = []
indent = { tab-width = 2, unit = " " }
block-comment-tokens = { start = "<!--", end = "-->" }

[[language]]
name = "markdown.inline"
scope = "source.markdown.inline"
Expand Down
1 change: 1 addition & 0 deletions runtime/queries/markdown-rustdoc/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: markdown
15 changes: 15 additions & 0 deletions runtime/queries/markdown-rustdoc/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; inherits: markdown

; In Rust, it is common to have documentation code blocks not specify the
; language, and it is assumed to be Rust if it is not specified.

(fenced_code_block
(code_fence_content) @injection.content
(#set! injection.language "rust")
(#set! injection.include-unnamed-children))

(fenced_code_block
(info_string
(language) @injection.language)
(code_fence_content) @injection.content (#set! injection.include-unnamed-children))

2 changes: 1 addition & 1 deletion runtime/queries/rust/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(#set! injection.language "comment"))

((doc_comment) @injection.content
(#set! injection.language "markdown")
(#set! injection.language "markdown-rustdoc")
(#set! injection.combined))

((macro_invocation
Expand Down