Skip to content

Commit 4268535

Browse files
authored
Add the ability to disable inline math (#378)
Fixes #196
1 parent 2baeabb commit 4268535

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

doc/pandoc-syntax.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ CONFIGURATION *vim-pandoc-syntax-configuration*
3838
- ellipses
3939
- quotes
4040
- inlinecode
41+
- inlinemath
4142

4243
To review what are the rules for, look for the call to |s:WithConceal| in
4344
syntax/pandoc.vim that takes the corresponding rulename as first argument.

syntax/pandoc.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,13 @@ call s:WithConceal('html_c_e', 'syn match pandocHTMLCommentEnd /-->/ contained',
263263
" Unset current_syntax so the 2nd include will work
264264
unlet b:current_syntax
265265
syn include @LATEX syntax/tex.vim
266-
syn region pandocLaTeXInlineMath start=/\v\\@<!\$\S@=/ end=/\v\\@<!\$\d@!/ keepend contains=@LATEX
267-
syn region pandocLaTeXInlineMath start=/\\\@<!\\(/ end=/\\\@<!\\)/ keepend contains=@LATEX
266+
if index(g:pandoc#syntax#conceal#blacklist, 'inlinemath') == -1
267+
" Can't use WithConceal here because it will mess up all other conceals
268+
" when dollar signs are used normally. It must be skipped entirely if
269+
" inlinemath is blacklisted
270+
syn region pandocLaTeXInlineMath start=/\v\\@<!\$\S@=/ end=/\v\\@<!\$\d@!/ keepend contains=@LATEX
271+
syn region pandocLaTeXInlineMath start=/\\\@<!\\(/ end=/\\\@<!\\)/ keepend contains=@LATEX
272+
endif
268273
syn match pandocEscapedDollar /\\\$/ conceal cchar=$
269274
syn match pandocProtectedFromInlineLaTeX /\\\@<!\${.*}\(\(\s\|[[:punct:]]\)\([^$]*\|.*\(\\\$.*\)\{2}\)\n\n\|$\)\@=/ display
270275
" contains=@LATEX

0 commit comments

Comments
 (0)