From 095d18a192d92b04fcbf2db015db817173e5aefb Mon Sep 17 00:00:00 2001 From: Jake Zimmerman Date: Mon, 19 Jan 2026 18:18:26 -0800 Subject: [PATCH] Add option to disable just `$...$` math, not `\(...\)` math Unlike pandoc itself, vim-pandoc-syntax eagerly treats everything after a `$` as inline math. The workaround for pandoc markdown documents that make heavy use of `$`-based prices is to use `\$`, which both pandoc and vim-pandoc-syntax recognize as a literal dollar sign. Personally, I would rather have `$` always mean a dollar sign, and use `\(...\)` for inline math, because I never use `\(...\)` for anything else. With that in mind, I've added a way to disable all special behavior for `$...$` inline math. --- doc/pandoc-syntax.txt | 1 + syntax/pandoc.vim | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/pandoc-syntax.txt b/doc/pandoc-syntax.txt index 1c9842b..2d2d3ae 100644 --- a/doc/pandoc-syntax.txt +++ b/doc/pandoc-syntax.txt @@ -39,6 +39,7 @@ CONFIGURATION *vim-pandoc-syntax-configuration* - quotes - inlinecode - inlinemath + - inlinemathdollar To review what are the rules for, look for the call to |s:WithConceal| in syntax/pandoc.vim that takes the corresponding rulename as first argument. diff --git a/syntax/pandoc.vim b/syntax/pandoc.vim index 90caeb3..23c1ad0 100644 --- a/syntax/pandoc.vim +++ b/syntax/pandoc.vim @@ -261,12 +261,15 @@ call s:WithConceal('html_c_e', 'syn match pandocHTMLCommentEnd /-->/ contained', " Unset current_syntax so the 2nd include will work unlet b:current_syntax syn include @LATEX syntax/tex.vim -if index(g:pandoc#syntax#conceal#blacklist, 'inlinemath') == -1 - " Can't use WithConceal here because it will mess up all other conceals - " when dollar signs are used normally. It must be skipped entirely if - " inlinemath is blacklisted +" Can't use WithConceal here because it will mess up all other conceals +" when dollar signs are used normally. It must be skipped entirely if +" inlinemath is blacklisted +if index(g:pandoc#syntax#conceal#blacklist, 'inlinemath') == -1 && + \ index(g:pandoc#syntax#conceal#blacklist, 'inlinemathdollar') == -1 syn region pandocLaTeXInlineMath start=/\v\\@