diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index f406db5..3393e6f 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -38,6 +38,18 @@ function! MarkdownFold() return ">2" endif + " Front matter + if v:lnum == 1 && line == '---' + let b:markdown_frontmatter = 1 + return ">1" + endif + + " End of front matter + if (line == '...') && b:markdown_frontmatter + unlet b:markdown_frontmatter + return '<1' + endif + return "=" endfunction diff --git a/syntax/markdown.vim b/syntax/markdown.vim index ad925cc..c46e22b 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -60,6 +60,10 @@ syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock syn region markdownCodeBlock start=" \|\t" end="$" contained +syn include @yamlTop syntax/yaml.vim +syntax match YAMLFrontMatter /\%^---\_.\{-}\.\.\.$/ contains=@yamlTop +unlet! b:current_syntax + " TODO: real nesting syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s\+\S\)\@=" contained