Skip to content
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

feature: Parse URLs out from plaintext paragraphs #164

Open
1 task done
keithfancher opened this issue Sep 28, 2024 · 0 comments
Open
1 task done

feature: Parse URLs out from plaintext paragraphs #164

keithfancher opened this issue Sep 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@keithfancher
Copy link

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

Currently, URLs are just treated as "normal" text within a paragraph/node. This means they can't be specifically queried for things like syntax highlighting, turning off spell-checking, etc. Particularly re: spell-checking, this makes for some noisy documents... e.g. note the squiggles below:

Screenshot from 2024-09-28 12-27-37

In the pre-tree-sitter days, one could simply regex match to disable spell-check as described here, for example.

Describe the solution you'd like

If URLs could be targeted with queries, it would be easy to turn off spell-check for them and also for color schemes to highlight URLs as they see fit. (Which is a common practice in various text editors, markdown viewers, etc.)

Describe alternatives you've considered

Just for the spell-check issue, my current workarounds involve one of the following:

  • Making all links explicitly [markdown links](http://blah.org)
  • Making all links explicitly <http://auto-links.org>
  • Turning off tree-sitter for markdown 😢

I've also experimented with the additional_vim_regex_highlighting option as described in the nvim-treesitter docs, but enabling it (and explicitly setting syntax on) still doesn't seem to allow the :syn match UrlNoSpell '\w\+:\/\/[^[:space:]]\+' contains=@NoSpell call to behave as expected -- tree-sitter must be completely disabled.

Additional context

No response

@keithfancher keithfancher added the enhancement New feature or request label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant