Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to disable inline math #378

Merged
merged 8 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/pandoc-syntax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ CONFIGURATION *vim-pandoc-syntax-configuration*
- ellipses
- quotes
- inlinecode
- inlinemath

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.
Expand Down
9 changes: 7 additions & 2 deletions syntax/pandoc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,13 @@ 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
syn region pandocLaTeXInlineMath start=/\v\\@<!\$\S@=/ end=/\v\\@<!\$\d@!/ keepend contains=@LATEX
syn region pandocLaTeXInlineMath start=/\\\@<!\\(/ end=/\\\@<!\\)/ keepend contains=@LATEX
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
syn region pandocLaTeXInlineMath start=/\v\\@<!\$\S@=/ end=/\v\\@<!\$\d@!/ keepend contains=@LATEX
syn region pandocLaTeXInlineMath start=/\\\@<!\\(/ end=/\\\@<!\\)/ keepend contains=@LATEX
endif
syn match pandocEscapedDollar /\\\$/ conceal cchar=$
syn match pandocProtectedFromInlineLaTeX /\\\@<!\${.*}\(\(\s\|[[:punct:]]\)\([^$]*\|.*\(\\\$.*\)\{2}\)\n\n\|$\)\@=/ display
" contains=@LATEX
Expand Down