syn match htmlH1 /^.\+\n=\+$/ contains=@Spell
syn match htmlH2 /^.\+\n-\+$/ contains=@Spell
-syn cluster mkdNonListItem contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdID,mkdURL,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
+
+" highlight YAML frontmatter
+syn include @yamlTop syntax/yaml.vim
+syntax match Comment /\%^---\_$\_.\{-}\_^---$/ contains=@yamlTop
"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
setlocal formatoptions+=r
+" Do not automatically insert bullets when auto-wrapping with text-width
+setlocal formatoptions-=c
" Accept various markers as bullets
setlocal comments=b:*,b:+,b:-
+" Automatically continue blockquote on line break
+setlocal comments+=b:>
+
let b:current_syntax = "mkd"
delcommand HtmlHiLink