From d34f4d8edf7e93f54a0e1c6d41c85e557db71ee7 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sat, 6 Sep 2014 16:02:30 +0200 Subject: [PATCH] Add LateX $ and $$ math support. --- README.md | 9 +++++++++ syntax/mkd.vim | 9 +++++++-- test/syntax.vader | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8ff3b59..6755e94 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,15 @@ Add the following line to your `.vimrc` to disable default key mappings. You can let g:vim_markdown_no_default_key_mappings=1 ``` +**Syntax extensions** + +The following options control which syntax extensions will be turned on. + +LaTeX math: `$ $`, `$$ $$`, escapable as `\$ \$` and `\$\$ \$\$`: + +```vim +let g:vim_markdown_math=1 +``` ## Mappings The following work on normal and visual modes: diff --git a/syntax/mkd.vim b/syntax/mkd.vim index 38c3502..19d59d5 100644 --- a/syntax/mkd.vim +++ b/syntax/mkd.vim @@ -94,7 +94,12 @@ syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contain syn match htmlH1 /^.\+\n=\+$/ contains=@Spell syn match htmlH2 /^.\+\n-\+$/ contains=@Spell -syn cluster mkdNonListItem contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdIndentCode,mkdListItem,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6 +if get(g:, 'vim_markdown_math', 0) + syn region mkdMath matchgroup=mkdDelimiter start="\\\@