-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How to match inline-code in comments? #34
Comments
Hi, exposing the text nodes from the parser was more like a hack in order to support uppercase only annotations (that don't end with If you are trying to highlight Markdown in your comments, what you probably want to do is just inject the Markdowm parser in the comments (instead of or in addition to this parser). Anyway, if you still want to manually match that, the problem is that |
Oh, that's a good idea! Is it possible to make "global injections", meaning for every filetype? Like, for instance, I wrote this to inject markdown into lua files, but it feels a bit tedious to add such injections for every single filetype. ; queries/lua/injections.scm
(comment
(comment_content) @injection.content (#set! injection.language "markdown")) Also, it seems to have a performance impact to inject markdown into every comment 😕
This could be the better way I guess. So I see the problem with the tokens—but how do I deal with that problem though? |
That's the way of doing it. If you are using Neovim, you may be able to override some internal lua function, maybe.
You need to write several queries for each case. Maybe something like this (("text" @_start "text"* @content "text" @_end)
(#match? @_start "^`")
(#match? @_end "^`")) |
I am trying to match inline code in comments, e.g. the "foobar" in here:
Following the example in the readme, I tried this:
Which correctly highlights
`foobar`
but not`foobar()`
or`foo.bar`
. I also tried variations like"`[a-zA-Z\.]+`"
for the regex, but those also did not work. I assume there are some limitations to the regex syntax, but in the docs I could find, I could not find clues?The text was updated successfully, but these errors were encountered: