mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-11 04:53:51 -05:00
Change markdown provider to plasticboy
This commit is contained in:
@@ -66,7 +66,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
|
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
|
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin, ftdetect)
|
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [markdown](https://github.com/tpope/vim-markdown) (syntax, ftplugin, ftdetect)
|
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, ftdetect)
|
||||||
- [nginx](https://github.com/othree/nginx-contrib-vim) (syntax, indent, ftdetect)
|
- [nginx](https://github.com/othree/nginx-contrib-vim) (syntax, indent, ftdetect)
|
||||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent, ftdetect)
|
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent, ftdetect)
|
||||||
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin, ftdetect)
|
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin, ftdetect)
|
||||||
|
|||||||
3
build
3
build
@@ -5,6 +5,7 @@ set -E
|
|||||||
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
|
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
|
||||||
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
|
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
|
||||||
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
||||||
|
DIRS_SYNTAX="syntax ftdetect after/syntax after/ftdetect"
|
||||||
|
|
||||||
OUTPUT=""
|
OUTPUT=""
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ PACKS="
|
|||||||
less:groenewege/vim-less
|
less:groenewege/vim-less
|
||||||
liquid:tpope/vim-liquid
|
liquid:tpope/vim-liquid
|
||||||
mako:sophacles/vim-bundle-mako
|
mako:sophacles/vim-bundle-mako
|
||||||
markdown:tpope/vim-markdown
|
markdown:plasticboy/vim-markdown:_SYNTAX
|
||||||
nginx:othree/nginx-contrib-vim
|
nginx:othree/nginx-contrib-vim
|
||||||
nim:zah/nim.vim:_BASIC
|
nim:zah/nim.vim:_BASIC
|
||||||
nix:spwhitt/vim-nix
|
nix:spwhitt/vim-nix
|
||||||
|
|||||||
@@ -276,12 +276,8 @@ au BufRead,BufNewFile *.mako set filetype=mako
|
|||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn
|
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown
|
||||||
\ if &ft =~# '^\%(conf\|modula2\)$' |
|
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} set filetype=markdown
|
||||||
\ set ft=markdown |
|
|
||||||
\ else |
|
|
||||||
\ setf markdown |
|
|
||||||
\ endif
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
||||||
|
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
|
|
||||||
|
|
||||||
" Vim filetype plugin
|
|
||||||
" Language: Markdown
|
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
||||||
" Last Change: 2013 May 30
|
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
|
||||||
|
|
||||||
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
|
|
||||||
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
|
|
||||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
|
|
||||||
|
|
||||||
if exists('b:undo_ftplugin')
|
|
||||||
let b:undo_ftplugin .= "|setl cms< com< fo< flp<"
|
|
||||||
else
|
|
||||||
let b:undo_ftplugin = "setl cms< com< fo< flp<"
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! MarkdownFold()
|
|
||||||
let line = getline(v:lnum)
|
|
||||||
|
|
||||||
" Regular headers
|
|
||||||
let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=')
|
|
||||||
if depth > 0
|
|
||||||
return ">" . depth
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Setext style headings
|
|
||||||
let nextline = getline(v:lnum + 1)
|
|
||||||
if (line =~ '^.\+$') && (nextline =~ '^=\+$')
|
|
||||||
return ">1"
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (line =~ '^.\+$') && (nextline =~ '^-\+$')
|
|
||||||
return ">2"
|
|
||||||
endif
|
|
||||||
|
|
||||||
return "="
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if has("folding") && exists("g:markdown_folding")
|
|
||||||
setlocal foldexpr=MarkdownFold()
|
|
||||||
setlocal foldmethod=expr
|
|
||||||
let b:undo_ftplugin .= " foldexpr< foldmethod<"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" vim:set sw=2:
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -2,163 +2,175 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -
|
|||||||
|
|
||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: Markdown
|
" Language: Markdown
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Ben Williams <benw@plasticboy.com>
|
||||||
" Filenames: *.markdown
|
" URL: http://plasticboy.com/markdown-vim-mode/
|
||||||
" Last Change: 2013 May 30
|
" Remark: Uses HTML syntax file
|
||||||
|
" TODO: Handle stuff contained within stuff (e.g. headings within blockquotes)
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
|
||||||
|
" Read the HTML syntax to start with
|
||||||
|
if version < 600
|
||||||
|
so <sfile>:p:h/html.vim
|
||||||
|
else
|
||||||
|
runtime! syntax/html.vim
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
unlet b:current_syntax
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('main_syntax')
|
" don't use standard HiLink, it will not work with included syntax files
|
||||||
let main_syntax = 'markdown'
|
if version < 508
|
||||||
|
command! -nargs=+ HtmlHiLink hi link <args>
|
||||||
|
else
|
||||||
|
command! -nargs=+ HtmlHiLink hi def link <args>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! syntax/html.vim
|
syn spell toplevel
|
||||||
unlet! b:current_syntax
|
|
||||||
|
|
||||||
if !exists('g:markdown_fenced_languages')
|
|
||||||
let g:markdown_fenced_languages = []
|
|
||||||
endif
|
|
||||||
let s:done_include = {}
|
|
||||||
for s:type in map(copy(g:markdown_fenced_languages),'matchstr(v:val,"[^=]*$")')
|
|
||||||
if has_key(s:done_include, matchstr(s:type,'[^.]*'))
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
if s:type =~ '\.'
|
|
||||||
let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*')
|
|
||||||
endif
|
|
||||||
exe 'syn include @markdownHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim'
|
|
||||||
unlet! b:current_syntax
|
|
||||||
let s:done_include[matchstr(s:type,'[^.]*')] = 1
|
|
||||||
endfor
|
|
||||||
unlet! s:type
|
|
||||||
unlet! s:done_include
|
|
||||||
|
|
||||||
syn sync minlines=10
|
|
||||||
syn case ignore
|
syn case ignore
|
||||||
|
syn sync linebreaks=1
|
||||||
|
|
||||||
syn match markdownValid '[<>]\c[a-z/$!]\@!'
|
let s:conceal = ''
|
||||||
syn match markdownValid '&\%(#\=\w*;\)\@!'
|
|
||||||
|
|
||||||
syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock,htmlSpecialChar
|
|
||||||
|
|
||||||
syn cluster markdownBlock contains=markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6,markdownBlockquote,markdownListMarker,markdownOrderedListMarker,markdownCodeBlock,markdownRule
|
|
||||||
syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError
|
|
||||||
|
|
||||||
syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
|
|
||||||
syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
|
|
||||||
|
|
||||||
syn match markdownHeadingRule "^[=-]\+$" contained
|
|
||||||
|
|
||||||
syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
|
||||||
syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
|
||||||
syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
|
||||||
syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
|
||||||
syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
|
||||||
syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
|
||||||
|
|
||||||
syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock
|
|
||||||
|
|
||||||
syn region markdownCodeBlock start=" \|\t" end="$" contained
|
|
||||||
|
|
||||||
" TODO: real nesting
|
|
||||||
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
|
|
||||||
syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s\+\S\)\@=" contained
|
|
||||||
|
|
||||||
syn match markdownRule "\* *\* *\*[ *]*$" contained
|
|
||||||
syn match markdownRule "- *- *-[ -]*$" contained
|
|
||||||
|
|
||||||
syn match markdownLineBreak " \{2,\}$"
|
|
||||||
|
|
||||||
syn region markdownIdDeclaration matchgroup=markdownLinkDelimiter start="^ \{0,3\}!\=\[" end="\]:" oneline keepend nextgroup=markdownUrl skipwhite
|
|
||||||
syn match markdownUrl "\S\+" nextgroup=markdownUrlTitle skipwhite contained
|
|
||||||
syn region markdownUrl matchgroup=markdownUrlDelimiter start="<" end=">" oneline keepend nextgroup=markdownUrlTitle skipwhite contained
|
|
||||||
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+"+ keepend contained
|
|
||||||
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained
|
|
||||||
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained
|
|
||||||
|
|
||||||
syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
|
|
||||||
syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained
|
|
||||||
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
|
|
||||||
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
|
|
||||||
|
|
||||||
let s:concealends = ''
|
let s:concealends = ''
|
||||||
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
|
if has('conceal') && get(g:, 'vim_markdown_conceal', 1)
|
||||||
|
let s:conceal = ' conceal'
|
||||||
let s:concealends = ' concealends'
|
let s:concealends = ' concealends'
|
||||||
endif
|
endif
|
||||||
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
|
|
||||||
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
|
|
||||||
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
|
|
||||||
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
|
|
||||||
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart' . s:concealends
|
|
||||||
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart' . s:concealends
|
|
||||||
|
|
||||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
|
" additions to HTML groups
|
||||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
|
if get(g:, 'vim_markdown_emphasis_multiline', 1)
|
||||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```*.*$" end="^\s*```*\ze\s*$" keepend
|
let s:oneline = ''
|
||||||
|
else
|
||||||
|
let s:oneline = ' oneline'
|
||||||
|
endif
|
||||||
|
execute 'syn region htmlItalic start="\%(^\|\s\)\zs\*\ze[^\\\*\t ]\%(\%([^*]\|\\\*\|\n\)*[^\\\*\t ]\)\?\*\_W" end="[^\\\*\t ]\zs\*\ze\_W" keepend' . s:oneline
|
||||||
|
execute 'syn region htmlItalic start="\%(^\|\s\)\zs_\ze[^\\_\t ]" end="[^\\_\t ]\zs_\ze\_W" keepend' . s:oneline
|
||||||
|
execute 'syn region htmlBold start="\%(^\|\s\)\*\*\ze\S" end="\S\zs\*\*" keepend' . s:oneline
|
||||||
|
execute 'syn region htmlBold start="\%(^\|\s\)\zs__\ze\S" end="\S\zs__" keepend' . s:oneline
|
||||||
|
execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs\*\*\*\ze\S" end="\S\zs\*\*\*" keepend' . s:oneline
|
||||||
|
execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs___\ze\S" end="\S\zs___" keepend' . s:oneline
|
||||||
|
|
||||||
syn match markdownFootnote "\[^[^\]]\+\]"
|
" [link](URL) | [link][id] | [link][] | 
|
||||||
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
|
syn region mkdFootnotes matchgroup=mkdDelimiter start="\[^" end="\]"
|
||||||
|
execute 'syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained oneline' . s:conceal
|
||||||
|
execute 'syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained oneline' . s:conceal
|
||||||
|
execute 'syn region mkdLink matchgroup=mkdDelimiter start="\\\@<!!\?\[" end="\n\{-,1}[^]]\{-}\zs\]\ze[[(]" contains=@mkdNonListItem,@Spell nextgroup=mkdURL,mkdID skipwhite oneline' . s:concealends
|
||||||
|
|
||||||
if main_syntax ==# 'markdown'
|
" Autolink without angle brackets.
|
||||||
let s:done_include = {}
|
" mkd inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment
|
||||||
for s:type in g:markdown_fenced_languages
|
" ------------ _____________________ ----------------------------- _________________________ ----------------- __
|
||||||
if has_key(s:done_include, matchstr(s:type,'[^.]*'))
|
syn match mkdInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
|
||||||
continue
|
|
||||||
endif
|
" Autolink with parenthesis.
|
||||||
exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```*\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
|
syn region mkdInlineURL matchgroup=mkdDelimiter start="(\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*)\)\@=" end=")"
|
||||||
let s:done_include[matchstr(s:type,'[^.]*')] = 1
|
|
||||||
endfor
|
" Autolink with angle brackets.
|
||||||
unlet! s:type
|
syn region mkdInlineURL matchgroup=mkdDelimiter start="\\\@<!<\ze[a-z][a-z0-9,.-]\{1,22}:\/\/[^> ]*>" end=">"
|
||||||
unlet! s:done_include
|
|
||||||
|
" Link definitions: [id]: URL (Optional Title)
|
||||||
|
syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
|
||||||
|
syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
|
||||||
|
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained
|
||||||
|
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
|
||||||
|
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
|
||||||
|
|
||||||
|
"HTML headings
|
||||||
|
syn region htmlH1 start="^\s*#" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
syn region htmlH2 start="^\s*##" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
syn region htmlH3 start="^\s*###" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
syn region htmlH4 start="^\s*####" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
syn region htmlH5 start="^\s*#####" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
syn region htmlH6 start="^\s*######" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
syn match htmlH1 /^.\+\n=\+$/ contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
|
||||||
|
"define Markdown groups
|
||||||
|
syn match mkdLineBreak / \+$/
|
||||||
|
syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell
|
||||||
|
syn region mkdCode start=/\(\([^\\]\|^\)\\\)\@<!`/ end=/\(\([^\\]\|^\)\\\)\@<!`/
|
||||||
|
syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
|
||||||
|
syn region mkdCode start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/
|
||||||
|
syn region mkdCode start=/\s*\~\~[^\~]*/ end=/[^\~]*\~\~\s*/
|
||||||
|
syn region mkdCode start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/
|
||||||
|
syn region mkdCode start="<pre[^>]*\\\@<!>" end="</pre>"
|
||||||
|
syn region mkdCode start="<code[^>]*\\\@<!>" end="</code>"
|
||||||
|
syn region mkdFootnote start="\[^" end="\]"
|
||||||
|
syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/
|
||||||
|
syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
|
||||||
|
syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ contained
|
||||||
|
syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\s\+/ contained
|
||||||
|
syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell
|
||||||
|
syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell
|
||||||
|
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
|
||||||
|
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
|
||||||
|
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
|
||||||
|
syn match mkdRule /^\s*-\{3,}$/
|
||||||
|
syn match mkdRule /^\s*\*\{3,5}$/
|
||||||
|
|
||||||
|
" YAML frontmatter
|
||||||
|
if get(g:, 'vim_markdown_frontmatter', 0)
|
||||||
|
syn include @yamlTop syntax/yaml.vim
|
||||||
|
syn region Comment matchgroup=mkdDelimiter start="\%^---$" end="^---$" contains=@yamlTop keepend
|
||||||
|
unlet! b:current_syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]"
|
if get(g:, 'vim_markdown_toml_frontmatter', 0)
|
||||||
syn match markdownError "\w\@<=_\w\@="
|
try
|
||||||
|
syn include @tomlTop syntax/toml.vim
|
||||||
hi def link markdownH1 htmlH1
|
syn region Comment matchgroup=mkdDelimiter start="\%^+++$" end="^+++$" transparent contains=@tomlTop keepend
|
||||||
hi def link markdownH2 htmlH2
|
unlet! b:current_syntax
|
||||||
hi def link markdownH3 htmlH3
|
catch /E484/
|
||||||
hi def link markdownH4 htmlH4
|
syn region Comment matchgroup=mkdDelimiter start="\%^+++$" end="^+++$"
|
||||||
hi def link markdownH5 htmlH5
|
endtry
|
||||||
hi def link markdownH6 htmlH6
|
|
||||||
hi def link markdownHeadingRule markdownRule
|
|
||||||
hi def link markdownHeadingDelimiter Delimiter
|
|
||||||
hi def link markdownOrderedListMarker markdownListMarker
|
|
||||||
hi def link markdownListMarker htmlTagName
|
|
||||||
hi def link markdownBlockquote Comment
|
|
||||||
hi def link markdownRule PreProc
|
|
||||||
|
|
||||||
hi def link markdownFootnote Typedef
|
|
||||||
hi def link markdownFootnoteDefinition Typedef
|
|
||||||
|
|
||||||
hi def link markdownLinkText htmlLink
|
|
||||||
hi def link markdownIdDeclaration Typedef
|
|
||||||
hi def link markdownId Type
|
|
||||||
hi def link markdownAutomaticLink markdownUrl
|
|
||||||
hi def link markdownUrl Float
|
|
||||||
hi def link markdownUrlTitle String
|
|
||||||
hi def link markdownIdDelimiter markdownLinkDelimiter
|
|
||||||
hi def link markdownUrlDelimiter htmlTag
|
|
||||||
hi def link markdownUrlTitleDelimiter Delimiter
|
|
||||||
|
|
||||||
hi def link markdownItalic htmlItalic
|
|
||||||
hi def link markdownItalicDelimiter markdownItalic
|
|
||||||
hi def link markdownBold htmlBold
|
|
||||||
hi def link markdownBoldDelimiter markdownBold
|
|
||||||
hi def link markdownBoldItalic htmlBoldItalic
|
|
||||||
hi def link markdownBoldItalicDelimiter markdownBoldItalic
|
|
||||||
hi def link markdownCodeDelimiter Delimiter
|
|
||||||
|
|
||||||
hi def link markdownEscape Special
|
|
||||||
hi def link markdownError Error
|
|
||||||
|
|
||||||
let b:current_syntax = "markdown"
|
|
||||||
if main_syntax ==# 'markdown'
|
|
||||||
unlet main_syntax
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vim:set sw=2:
|
if get(g:, 'vim_markdown_json_frontmatter', 0)
|
||||||
|
try
|
||||||
|
syn include @jsonTop syntax/json.vim
|
||||||
|
syn region Comment matchgroup=mkdDelimiter start="\%^{$" end="^}$" contains=@jsonTop keepend
|
||||||
|
unlet! b:current_syntax
|
||||||
|
catch /E484/
|
||||||
|
syn region Comment matchgroup=mkdDelimiter start="\%^{$" end="^}$"
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get(g:, 'vim_markdown_math', 0)
|
||||||
|
syn include @tex syntax/tex.vim
|
||||||
|
syn region mkdMath start="\\\@<!\$" end="\$" contains=@tex keepend
|
||||||
|
syn region mkdMath start="\\\@<!\$\$" end="\$\$" contains=@tex keepend
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath
|
||||||
|
|
||||||
|
"highlighting for Markdown groups
|
||||||
|
HtmlHiLink mkdString String
|
||||||
|
HtmlHiLink mkdCode String
|
||||||
|
HtmlHiLink mkdCodeStart String
|
||||||
|
HtmlHiLink mkdCodeEnd String
|
||||||
|
HtmlHiLink mkdFootnote Comment
|
||||||
|
HtmlHiLink mkdBlockquote Comment
|
||||||
|
HtmlHiLink mkdListItem Identifier
|
||||||
|
HtmlHiLink mkdRule Identifier
|
||||||
|
HtmlHiLink mkdLineBreak Visual
|
||||||
|
HtmlHiLink mkdFootnotes htmlLink
|
||||||
|
HtmlHiLink mkdLink htmlLink
|
||||||
|
HtmlHiLink mkdURL htmlString
|
||||||
|
HtmlHiLink mkdInlineURL htmlLink
|
||||||
|
HtmlHiLink mkdID Identifier
|
||||||
|
HtmlHiLink mkdLinkDef mkdID
|
||||||
|
HtmlHiLink mkdLinkDefTarget mkdURL
|
||||||
|
HtmlHiLink mkdLinkTitle htmlString
|
||||||
|
HtmlHiLink mkdDelimiter Delimiter
|
||||||
|
|
||||||
|
let b:current_syntax = "mkd"
|
||||||
|
|
||||||
|
delcommand HtmlHiLink
|
||||||
|
" vim: ts=8
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user