From 205102f37243e49fc1608635a38811ecc282d14c Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 23 Jul 2024 20:08:03 -0500 Subject: [PATCH] feat(markdown): set url attribute on plain URLs Setting the url attribute on actual URLs will cause Nvim to use the OSC 8 sequence on the entire URL, which enables terminal emulators to detect the URL even when it is wrapped. The (uri_autolink) node must use an #offset! directive to strip the surrounding <> characters from the URL. --- queries/markdown_inline/highlights.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/queries/markdown_inline/highlights.scm b/queries/markdown_inline/highlights.scm index 10bb5b060..ac99cce5f 100644 --- a/queries/markdown_inline/highlights.scm +++ b/queries/markdown_inline/highlights.scm @@ -88,6 +88,13 @@ (email_autolink) ] @markup.link.url @nospell +((link_destination) @_url + (#set! @_url "url" @_url)) + +((uri_autolink) @_url + (#offset! @_url 0 1 0 -1) + (#set! @_url "url" @_url)) + (entity_reference) @nospell ; Replace common HTML entities.