From 536f4294f6a6fc49bd9834152ac632d4974ebbd2 Mon Sep 17 00:00:00 2001 From: Jonathan Lopez Date: Tue, 21 Jun 2022 15:59:47 -0400 Subject: Refactor markdown conceal code --- queries/markdown/highlights.scm | 46 ++++++++++++++++++++++------------------- 1 file 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 "")) -- cgit v1.2.3-70-g09d2