-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Initial basic Org markup support thanks to tree-sitter-org #1845
Conversation
This is looking good! For the docs, you'll need to run |
Alright pretty happy with this, I kind of want to have different highlights for TODO and DONE etc, but a tree-sitter parser shouldn't be responsible for that. Also wanted a different query for links, but I couldn't find the query for that. An example org file: https://writequit.org/denver-emacs/presentations/files/example.org.html |
Giving this a try locally, I see that some markup is more difficult to highlight than I expected.
won't match the ((expr) @markup.italic
(#match? @markup.italic "/.*/")) pattern because it gets parsed as three separate (((expr) @markup.italic @_start
(expr)* @markup.italic
(expr) @markup.italic @_end)
(#match? @_start "^/")
(#match? @_end "/$")) but I tried that locally and it degrades highlighting performance really bad. I think for now these queries are the best we can do. We could try out another parser, but milisims' seems like the best option of the available parsers. Ideally this parser should be refactored so it would parse markup into named nodes instead of leaving it to the queries. (I bet that this would be a pretty large refactor of the grammar though.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good, just some nits about the formatting 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Using (and many thanks to):
https://github.com/milisims/tree-sitter-org
https://github.com/nvim-orgmode/orgmode/tree/master/queries/org
And the-mikedavis from the matrix chat. I think I need to add a few more things like docs, but I would like to first know and what I can add and what I can improve?
Ideally I'd want the headers to be a different colors each(I think this is a theming thing though) and property drawers to be colored different as well. Not entirely sure how to go about it?