aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Lopez <jonathanglopez@gmail.com>2022-06-21 15:59:47 -0400
committerStephan Seitz <stephan.seitz@fau.de>2022-06-22 13:56:11 +0200
commit536f4294f6a6fc49bd9834152ac632d4974ebbd2 (patch)
tree822edf82f88df75f0a44dacb37262c86a107917f
parentConceal markdown links (diff)
downloadnvim-treesitter-536f4294f6a6fc49bd9834152ac632d4974ebbd2.tar
nvim-treesitter-536f4294f6a6fc49bd9834152ac632d4974ebbd2.tar.gz
nvim-treesitter-536f4294f6a6fc49bd9834152ac632d4974ebbd2.tar.bz2
nvim-treesitter-536f4294f6a6fc49bd9834152ac632d4974ebbd2.tar.lz
nvim-treesitter-536f4294f6a6fc49bd9834152ac632d4974ebbd2.tar.xz
nvim-treesitter-536f4294f6a6fc49bd9834152ac632d4974ebbd2.tar.zst
nvim-treesitter-536f4294f6a6fc49bd9834152ac632d4974ebbd2.zip
Refactor markdown conceal code
-rw-r--r--queries/markdown/highlights.scm46
1 files changed, 25 insertions, 21 deletions
diff --git a/queries/markdown/highlights.scm b/queries/markdown/highlights.scm
index b7b75b350..dbb79fa31 100644
--- a/queries/markdown/highlights.scm
+++ b/queries/markdown/highlights.scm
@@ -81,32 +81,36 @@
] @conceal
(#set! conceal ""))
-(inline_link
- ["]"] @conceal
- (#set! conceal " "))
+;; Inline_link Conceal
+; Conceal preceeding "[" character for inline links
(inline_link
"[" @conceal
(#set! conceal ""))
-;; Conceal @text.uri preceding '('
-([
- (link_label)
- (link_text)
- (image_description)
-] ["("] @conceal
-(#set! conceal ""))
-
-;; Conceal @text.uri text
-([
- (link_destination)
- (uri_autolink)
+; Conceal inline links
+(inline_link
+ [
+ "]"
+ "("
+ (link_destination)
+ ")"
] @conceal
(#set! conceal ""))
-;; Conceal @text.uri proceding '('
-([
- (link_destination)
- (uri_autolink)
-] [")"] @conceal
-(#set! conceal ""))
+
+;; Image Conceal
+; Conceal preceeding "!" and "[" characters for image links
+(image
+ ["!" "["] @conceal
+ (#set! conceal ""))
+
+; Conceal image links
+(image
+ [
+ "]"
+ "("
+ (link_destination)
+ ")"
+] @conceal
+ (#set! conceal ""))