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

feat: allow TS users to highlight marker delimiters #623

Merged

Conversation

PriceHiller
Copy link
Contributor

@PriceHiller PriceHiller commented Oct 31, 2023

Hello! This PR permits (as per the current commit) a user of orgmode to set the highlights for the delimiters around
markers.

Take for instance something like:

=Hello world=

Prior to this PR those of us who used Treesitter with Nvim-Orgmode were unable to specify a specific highlight for the
equals sign, =. I have added a simple syntax match for those markers and bound them according to their main marker
group name. For instance, the org_code group also has org_code_delimiter now relating to its beginning and ending
delimiters.

I'm taking advantage of the extmarks that were set to highlight the entire block by using offsets. If you know of a
better way, feel free share! I'm willing to implement a better implementation if I can get a pointer; otherwise this
gets the job done.

Before (unable to change the highlights for the ~ delimiters):
image

After:
image

@PriceHiller PriceHiller force-pushed the feat/ts-delimiter-highlights branch 2 times, most recently from d164905 to 772c7d6 Compare October 31, 2023 20:53
This permits those of us who use treesitter to change the highlights
surrounding markers. E.g. for the "verbatim" marker we can now highlight
the "=" characters individually instead of the entire chunk being the
same highlight.

This is particularly useful in tables with lots of code elements, this
makes it easier to tell the delimiter characters apart from the primary
marker.
@PriceHiller PriceHiller force-pushed the feat/ts-delimiter-highlights branch from 772c7d6 to b8c4ece Compare October 31, 2023 20:55
Copy link
Member

@kristijanhusak kristijanhusak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Generally looks good, but it needs some minor cleanup.

lua/orgmode/colors/markup_highlighter.lua Outdated Show resolved Hide resolved
lua/orgmode/colors/markup_highlighter.lua Outdated Show resolved Hide resolved
See nvim-orgmode#623 (comment)

> I don't think we need this. `syn` is used for old Vim syntax highlighting.
PriceHiller added a commit to PriceHiller/orgmode that referenced this pull request Nov 2, 2023
See nvim-orgmode#623 (comment)

> We don't need delimiters highlight for `latex` type since we do not handle those markers as markup and we do not add extmarks for them.
PriceHiller added a commit to PriceHiller/orgmode that referenced this pull request Nov 2, 2023
See nvim-orgmode#623 (comment)

> We don't need delimiters highlight for `latex` type since we do not handle those markers as markup and we do not add extmarks for them.
@PriceHiller PriceHiller force-pushed the feat/ts-delimiter-highlights branch from 1bebec3 to c286e87 Compare November 2, 2023 16:25
See nvim-orgmode#623 (comment)

> We don't need delimiters highlight for `latex` type since we do not handle those markers as markup and we do not add extmarks for them.
@PriceHiller PriceHiller force-pushed the feat/ts-delimiter-highlights branch from c286e87 to 056107d Compare November 2, 2023 16:30
Copy link
Member

@kristijanhusak kristijanhusak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@kristijanhusak kristijanhusak merged commit de26d82 into nvim-orgmode:master Nov 2, 2023
4 checks passed
@PriceHiller PriceHiller deleted the feat/ts-delimiter-highlights branch November 2, 2023 17:16
SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this pull request Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants