diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index fb42d01..c55b653 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -54,6 +54,18 @@ function! MarkdownFold() abort 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 a069746..043f903 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -85,6 +85,10 @@ syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock syn region markdownCodeBlock start="^\n\( \{4,}\|\t\)" end="^\ze \{,3}\S.*$" keepend +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