Skip to content

feat(links)!: allow granular highlighting of links #965

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

Merged
merged 1 commit into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/configuration.org
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,9 @@ The following highlight groups are used:
- =@org.code.delimiter=: code text delimiter =~= - linked to =@markup.raw=,
- =@org.verbatim=: =verbatim= text - linked to =@markup.raw=,
- =@org.verbatim.delimiter=: verbatim text delimiter === - linked to =@markup.raw=,
- =@org.hyperlink=: =[[file:link]]= text - linked to =@markup.link.url=,
- =@org.hyperlink=: link without description (example: =[[file:/this/is/link]]=) - linked to =@markup.link=,
- =@org.hyperlink.url=: Url part of the link with description (example: =[[file:/this/is/url][description]]=) - linked to =@markup.link.url=,
- =@org.hyperlink.desc=: Description part of the link with description (example: =[[file:/path/to/file][description]]=) - linked to =@markup.link.label=,
- =@org.latex=: Inline latex - linked to =@markup.math=,
- =@org.table.delimiter= - =|= and =-= delimiters in tables - linked to =@punctuation.special=,
- =@org.table.heading= - Table headings - linked to =@markup.heading=,
Expand Down
4 changes: 3 additions & 1 deletion lua/orgmode/colors/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ function M.link_highlights()
['@org.code.delimiter'] = '@markup.raw',
['@org.verbatim'] = '@markup.raw',
['@org.verbatim.delimiter'] = '@markup.raw',
['@org.hyperlink'] = '@markup.link.url',
['@org.hyperlink'] = '@markup.link',
['@org.hyperlink.url'] = '@markup.link.url',
['@org.hyperlink.desc'] = '@markup.link.label',
['@org.latex'] = '@markup.math',
['@org.latex_env'] = '@markup.environment',
['@org.footnote'] = '@markup.link.url',
Expand Down
4 changes: 2 additions & 2 deletions queries/org/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
(table . (row (cell (contents) @org.table.heading)))
(table (hr) @org.table.delimiter)
(fndef label: (expr) @org.footnote (#offset! @org.footnote 0 -4 0 1))
(link) @org.hyperlink
(link_desc) @org.hyperlink
(link url: (expr) @org.hyperlink.url) @org.hyperlink
(link_desc url: (expr) @org.hyperlink.url desc: (expr) @org.hyperlink.desc) @org.hyperlink
(link "[[" @_link_open "]]" @_link_close (#set! conceal ""))
(link_desc "[[" @_link_open "][" @_link_separator "]]" @_link_close (#set! conceal ""))
((link_desc url: (expr)+ @_link_url (#set! @_link_url conceal "")) @_link (#set! @_link url @_link_url))