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:
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="\\\@<!\$" end="\$"
+ syn region mkdMath matchgroup=mkdDelimiter start="\\\@<!\$\$" end="\$\$"
+endif
+
+syn cluster mkdNonListItem contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdID,mkdURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdMath,mkdIndentCode,mkdListItem,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
"highlighting for Markdown groups
HtmlHiLink mkdString String
HtmlHiLink mkdLinkDef mkdID
HtmlHiLink mkdLinkDefTarget mkdURL
HtmlHiLink mkdLinkTitle htmlString
-
+HtmlHiLink mkdMath Statement
HtmlHiLink mkdDelimiter Delimiter
" Automatically insert bullets
Execute (SyntaxOf(pattern)):
AssertEqual SyntaxOf('i'), 'htmlItalic'
+# Links
+
Given mkd;
[a](b)
Execute (multiple links on a line):
AssertEqual SyntaxOf('c'), ''
+
+# Math
+
+Given mkd;
+a $x$ b
+c $$y$$ d
+\$e\$
+\$\$f\$\$
+
+Execute (math):
+ AssertNotEqual SyntaxOf('x'), 'mkdMath'
+ AssertNotEqual SyntaxOf('y'), 'mkdMath'
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a'), 'mkdMath'
+ AssertNotEqual SyntaxOf('b'), 'mkdMath'
+ AssertNotEqual SyntaxOf('c'), 'mkdMath'
+ AssertNotEqual SyntaxOf('d'), 'mkdMath'
+ AssertNotEqual SyntaxOf('e'), 'mkdMath'
+ AssertNotEqual SyntaxOf('f'), 'mkdMath'
+ AssertEqual SyntaxOf('x'), 'mkdMath'
+ AssertEqual SyntaxOf('y'), 'mkdMath'
+ let g:vim_markdown_math=0
+ syn off | syn on
+ AssertNotEqual SyntaxOf('x'), 'mkdMath'
+ AssertNotEqual SyntaxOf('y'), 'mkdMath'
+
+Given mkd;
+a
+
+$
+b
+$
+
+c
+
+Execute (multiline math):
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a'), 'mkdMath'
+ AssertEqual SyntaxOf('b'), 'mkdMath'
+ AssertNotEqual SyntaxOf('c'), 'mkdMath'