2024-01-06 15:05:50 +09:00
|
|
|
; Inject markdown in docstrings
|
2024-11-22 13:09:12 +01:00
|
|
|
((string_literal
|
|
|
|
|
(content) @injection.content)
|
2024-01-06 15:05:50 +09:00
|
|
|
.
|
|
|
|
|
[
|
2022-12-14 03:06:08 -05:00
|
|
|
(module_definition)
|
|
|
|
|
(abstract_definition)
|
|
|
|
|
(struct_definition)
|
|
|
|
|
(function_definition)
|
2024-08-06 17:27:04 -05:00
|
|
|
(macro_definition)
|
2022-12-14 03:06:08 -05:00
|
|
|
(assignment)
|
2023-07-05 18:14:04 -05:00
|
|
|
(const_statement)
|
2024-11-22 13:54:32 +01:00
|
|
|
(call_expression)
|
|
|
|
|
(identifier)
|
2022-12-14 03:06:08 -05:00
|
|
|
]
|
2024-11-22 13:09:12 +01:00
|
|
|
(#set! injection.language "markdown"))
|
2021-03-12 11:21:46 -05:00
|
|
|
|
2024-07-23 20:26:57 -04:00
|
|
|
; Inject comments
|
2023-05-03 19:07:59 +09:00
|
|
|
([
|
2022-04-15 10:30:46 +02:00
|
|
|
(line_comment)
|
2022-01-13 17:35:20 +01:00
|
|
|
(block_comment)
|
2024-01-06 15:05:50 +09:00
|
|
|
] @injection.content
|
|
|
|
|
(#set! injection.language "comment"))
|
2022-11-26 14:27:21 +02:00
|
|
|
|
2024-11-22 13:09:12 +01:00
|
|
|
; Inject regex in r"..." and r"""...""" (e.g. r"hello\bworld")
|
|
|
|
|
(prefixed_string_literal
|
|
|
|
|
prefix: (identifier) @_prefix
|
|
|
|
|
(content) @injection.content
|
2024-01-06 15:05:50 +09:00
|
|
|
(#eq? @_prefix "r")
|
2024-11-22 13:09:12 +01:00
|
|
|
(#set! injection.language "regex"))
|
2024-07-23 20:26:57 -04:00
|
|
|
|
2024-11-22 13:09:12 +01:00
|
|
|
; Inject markdown in md"..." and md"""...""" (e.g. md"**Bold** and _Italics_")
|
|
|
|
|
(prefixed_string_literal
|
|
|
|
|
prefix: (identifier) @_prefix
|
|
|
|
|
(content) @injection.content
|
2024-07-23 20:26:57 -04:00
|
|
|
(#eq? @_prefix "md")
|
2024-11-22 13:09:12 +01:00
|
|
|
(#set! injection.language "markdown"))
|
2024-07-23 20:26:57 -04:00
|
|
|
|
2024-11-22 13:09:12 +01:00
|
|
|
; Inject bash in `...` and ```...``` (e.g. `git add --help`)
|
|
|
|
|
(command_literal
|
|
|
|
|
(content) @injection.content
|
2024-07-23 20:26:57 -04:00
|
|
|
(#set! injection.language "bash"))
|