Skip to content

Commit 76d73fd

Browse files
committed
allow urls in links to be concealed
Implements issue #92. The concealment is configured through the *g:pandoc#syntax#conceal#urls* variable. Also, minor changes re: pandocNoFormattedInEmphasis
1 parent 797caa1 commit 76d73fd

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

doc/pandoc-syntax.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ CONFIGURATION *vim-pandoc-syntax-configuration*
4848

4949
let g:pandoc#syntax#conceal#cchar_overrides = ["footnote" : "*"]
5050

51+
+ *g:pandoc#syntax#conceal#urls*
52+
Conceal the urls in links.
53+
5154
+ *g:pandoc#syntax#codeblocks#ignore*
5255
Prevent highlighting specific codeblock types so that they remain Normal.
5356
Codeblock types include 'definition' for codeblocks inside definition blocks

syntax/pandoc.vim

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ if exists("g:pandoc#syntax#conceal#cchar_overrides")
6868
let s:cchars = extend(s:cchars, g:pandoc#syntax#conceal#cchar_overrides)
6969
endif
7070
"}}}2
71+
"should the urls in links be concealed? {{{2
72+
if !exists("g:pandoc#syntax#conceal#urls")
73+
let g:pandoc#syntax#conceal#urls = 0
74+
endif
75+
"}}}2
7176
" leave specified codeblocks as Normal (i.e. 'unhighlighted') {{{2
7277
if !exists("g:pandoc#syntax#codeblocks#ignore")
7378
let g:pandoc#syntax#codeblocks#ignore = []
@@ -216,7 +221,11 @@ syn region pandocCodeBlockInsideIndent start=/\(\(\d\|\a\|*\).*\n\)\@<!\(^\(\s
216221
"
217222
" Base: {{{2
218223
syn region pandocReferenceLabel matchgroup=Operator start=/!\{,1}\[/ skip=/\]\]\@=/ end=/\]/ keepend display
219-
syn region pandocReferenceURL matchgroup=Operator start=/\]\@1<=(/ end=/)/ keepend display
224+
if g:pandoc#syntax#conceal#urls == 1
225+
syn region pandocReferenceURL matchgroup=Operator start=/\]\@1<=(/ end=/)/ keepend display conceal
226+
else
227+
syn region pandocReferenceURL matchgroup=Operator start=/\]\@1<=(/ end=/)/ keepend display
228+
endif
220229
" let's not consider "a [label] a" as a label, remove formatting - Note: breaks implicit links
221230
syn match pandocNoLabel /\]\@1<!\s*\[[^\[\]]\{-}\]\s*[\[(]\@!/ contains=pandocPCite
222231
syn match pandocLinkTip /\s*".\{-}"/ contained containedin=pandocReferenceURL contains=@Spell display
@@ -533,7 +542,7 @@ if g:pandoc#syntax#style#emphases == 1
533542
if !exists('s:hi_tail')
534543
for s:i in ["fg", "bg"]
535544
let s:tmp_val = synIDattr(synIDtrans(hlID("String")), s:i)
536-
let s:tmp_ui = has('gui_running') ? ' gui' : ' cterm'
545+
let s:tmp_ui = has('gui_running') ? 'gui' : 'cterm'
537546
if !empty(s:tmp_val) && s:tmp_val != -1
538547
exe 'let s:'.s:i . ' = "'.s:tmp_ui.s:i.'='.s:tmp_val.'"'
539548
else

0 commit comments

Comments
 (0)