mirror of
https://github.com/tpope/vim-markdown.git
synced 2025-11-18 06:43:40 -05:00
Compare commits
110 Commits
fenced_hig
...
bb5a651b3b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb5a651b3b | ||
|
|
f405b47fd8 | ||
|
|
f2b82b7884 | ||
|
|
feadbc81e2 | ||
|
|
a282dd89fb | ||
|
|
b78bbce337 | ||
|
|
b52c46dd8e | ||
|
|
6be354e576 | ||
|
|
ff1caeadba | ||
|
|
891dff54a9 | ||
|
|
59a551feb2 | ||
|
|
ec486958ea | ||
|
|
db82f00b58 | ||
|
|
c7988e88a2 | ||
|
|
e2acae8cef | ||
|
|
23213f39db | ||
|
|
ed76403b2e | ||
|
|
82a10f4137 | ||
|
|
addd5abaa6 | ||
|
|
3cdd8a9b76 | ||
|
|
9d87cc1917 | ||
|
|
855b8915e0 | ||
|
|
65cb65a31a | ||
|
|
f08447c76b | ||
|
|
baf2592d33 | ||
|
|
276524ed9c | ||
|
|
a1ed88889c | ||
|
|
9ff8d52c78 | ||
|
|
de0456245c | ||
|
|
a88cfb6fc2 | ||
|
|
296eeaa887 | ||
|
|
f35c43c535 | ||
|
|
6c4c60fbaa | ||
|
|
719b046bbe | ||
|
|
191438f358 | ||
|
|
4e25b2f606 | ||
|
|
e875717243 | ||
|
|
a273e6d1f3 | ||
|
|
9c2133fef0 | ||
|
|
8a76c845de | ||
|
|
1a436852ac | ||
|
|
06a62df8a5 | ||
|
|
a6866ac0aa | ||
|
|
5363a4d803 | ||
|
|
64689dfeae | ||
|
|
a2e123a288 | ||
|
|
c043a93c84 | ||
|
|
fd3f4831be | ||
|
|
5e1ac0ee60 | ||
|
|
57c58269a2 | ||
|
|
8946b2ecc1 | ||
|
|
c74710e89b | ||
|
|
d6012fe996 | ||
|
|
d7053febeb | ||
|
|
4831a1241c | ||
|
|
6f6ff4c922 | ||
|
|
e2d7fcd682 | ||
|
|
8cd41796fd | ||
|
|
a7dbc31456 | ||
|
|
44822aa3c6 | ||
|
|
1e6798717a | ||
|
|
0b92a7d4cb | ||
|
|
3c2215bfed | ||
|
|
5c21f16771 | ||
|
|
4260faa48f | ||
|
|
0df8de0b50 | ||
|
|
ee550a7b2b | ||
|
|
63074a52ad | ||
|
|
de42c8a325 | ||
|
|
b938671300 | ||
|
|
15d19778a3 | ||
|
|
64e5a2f200 | ||
|
|
e8a6e373f2 | ||
|
|
6eac9ffb58 | ||
|
|
578647a9de | ||
|
|
aff85c6411 | ||
|
|
ba294150d1 | ||
|
|
188d816314 | ||
|
|
409c37b205 | ||
|
|
cd81c2f209 | ||
|
|
14977fb9df | ||
|
|
cb2b885214 | ||
|
|
db5c79f7c0 | ||
|
|
b3cea72eea | ||
|
|
b02182ebbd | ||
|
|
355c8e9bb5 | ||
|
|
ede001b33d | ||
|
|
61deff1362 | ||
|
|
3fb5b260e1 | ||
|
|
a126974366 | ||
|
|
fccf76f68f | ||
|
|
55b49cad42 | ||
|
|
451eefb9b2 | ||
|
|
d9b041af65 | ||
|
|
697edbe7ca | ||
|
|
de106cb725 | ||
|
|
ec0abb3064 | ||
|
|
90fc7fc593 | ||
|
|
e8fa4faf82 | ||
|
|
5ed43c22bc | ||
|
|
242dda3f01 | ||
|
|
10cf9687d2 | ||
|
|
9407dae660 | ||
|
|
ecafbe32a8 | ||
|
|
b2697b0adf | ||
|
|
dcdab0cd55 | ||
|
|
7b747d0aa4 | ||
|
|
9a21f7a6bc | ||
|
|
3a99157473 | ||
|
|
fdc0f091c7 |
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github: tpope
|
||||
custom: ["https://www.paypal.me/vimpope"]
|
||||
45
README.markdown
Normal file
45
README.markdown
Normal file
@@ -0,0 +1,45 @@
|
||||
# Vim Markdown runtime files
|
||||
|
||||
This is the development version of Vim's included syntax highlighting and
|
||||
filetype plugins for Markdown. Generally you don't need to install these if
|
||||
you are running a recent version of Vim.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Fenced code block highlighting
|
||||
|
||||
To enable fenced code block syntax highlighting in your markdown
|
||||
documents, add the following to your `.vimrc`:
|
||||
|
||||
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
|
||||
|
||||
**Note**: The fenced language names must be valid names of syntax files in vim's
|
||||
`syntax` folder. For example: `syntax/ruby.vim`.
|
||||
|
||||
### Syntax concealment
|
||||
|
||||
To disable markdown syntax concealing, add the following to your `.vimrc`:
|
||||
|
||||
let g:markdown_syntax_conceal = 0
|
||||
|
||||
### Highlighting synchronization
|
||||
|
||||
Syntax highlighting is synchronized in 50 lines. This may cause collapsed
|
||||
highlighting on large fenced code blocks.
|
||||
In that case, set `g:markdown_minlines` to a larger value in your `.vimrc`:
|
||||
|
||||
let g:markdown_minlines = 100
|
||||
|
||||
**Note**: Setting `g:markdown_minlines` to a value that is too large value may
|
||||
cause poor highlighting performance.
|
||||
|
||||
### Folding
|
||||
|
||||
To enable folding, add the following to your `.vimrc`:
|
||||
|
||||
let g:markdown_folding = 1
|
||||
|
||||
## License
|
||||
|
||||
Copyright © Tim Pope. Distributed under the same terms as Vim itself.
|
||||
See `:help license`.
|
||||
@@ -1,4 +1,4 @@
|
||||
autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn
|
||||
autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn,*.mdwn
|
||||
\ if &ft =~# '^\%(conf\|modula2\)$' |
|
||||
\ set ft=markdown |
|
||||
\ else |
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Markdown
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Language: Markdown
|
||||
" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
|
||||
" Last Change: 2022 Oct 13
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
@@ -8,10 +9,84 @@ endif
|
||||
|
||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
||||
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
|
||||
setlocal formatoptions+=tcqln
|
||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+
|
||||
let s:keepcpo= &cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:undo_ftplugin .= "|setl cms< com< fo<"
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
|
||||
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
|
||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}
|
||||
|
||||
if exists('b:undo_ftplugin')
|
||||
let b:undo_ftplugin .= "|setl cms< com< fo< flp< et< ts< sts< sw<"
|
||||
else
|
||||
let b:undo_ftplugin = "setl cms< com< fo< flp< et< ts< sts< sw<"
|
||||
endif
|
||||
|
||||
if get(g:, 'markdown_recommended_style', 1)
|
||||
setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=4
|
||||
endif
|
||||
|
||||
if !exists("g:no_plugin_maps") && !exists("g:no_markdown_maps")
|
||||
nnoremap <silent><buffer> [[ :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>
|
||||
nnoremap <silent><buffer> ]] :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>
|
||||
xnoremap <silent><buffer> [[ :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>
|
||||
xnoremap <silent><buffer> ]] :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>
|
||||
let b:undo_ftplugin .= '|sil! nunmap <buffer> [[|sil! nunmap <buffer> ]]|sil! xunmap <buffer> [[|sil! xunmap <buffer> ]]'
|
||||
endif
|
||||
|
||||
function! s:NotCodeBlock(lnum) abort
|
||||
return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCodeBlock'
|
||||
endfunction
|
||||
|
||||
function! MarkdownFold() abort
|
||||
let line = getline(v:lnum)
|
||||
|
||||
if line =~# '^#\+ ' && s:NotCodeBlock(v:lnum)
|
||||
return ">" . match(line, ' ')
|
||||
endif
|
||||
|
||||
let nextline = getline(v:lnum + 1)
|
||||
if (line =~ '^.\+$') && (nextline =~ '^=\+$') && s:NotCodeBlock(v:lnum + 1)
|
||||
return ">1"
|
||||
endif
|
||||
|
||||
if (line =~ '^.\+$') && (nextline =~ '^-\+$') && s:NotCodeBlock(v:lnum + 1)
|
||||
return ">2"
|
||||
endif
|
||||
|
||||
return "="
|
||||
endfunction
|
||||
|
||||
function! s:HashIndent(lnum) abort
|
||||
let hash_header = matchstr(getline(a:lnum), '^#\{1,6}')
|
||||
if len(hash_header)
|
||||
return hash_header
|
||||
else
|
||||
let nextline = getline(a:lnum + 1)
|
||||
if nextline =~# '^=\+\s*$'
|
||||
return '#'
|
||||
elseif nextline =~# '^-\+\s*$'
|
||||
return '##'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! MarkdownFoldText() abort
|
||||
let hash_indent = s:HashIndent(v:foldstart)
|
||||
let title = substitute(getline(v:foldstart), '^#\+\s*', '', '')
|
||||
let foldsize = (v:foldend - v:foldstart + 1)
|
||||
let linecount = '['.foldsize.' lines]'
|
||||
return hash_indent.' '.title.' '.linecount
|
||||
endfunction
|
||||
|
||||
if has("folding") && get(g:, "markdown_folding", 0)
|
||||
setlocal foldexpr=MarkdownFold()
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldtext=MarkdownFoldText()
|
||||
let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
|
||||
endif
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
@@ -1,50 +1,98 @@
|
||||
" Vim syntax file
|
||||
" Language: Markdown
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
|
||||
" Filenames: *.markdown
|
||||
" Last Change: 2022 Oct 13
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('main_syntax')
|
||||
let main_syntax = 'markdown'
|
||||
endif
|
||||
|
||||
if has('folding')
|
||||
let s:foldmethod = &l:foldmethod
|
||||
let s:foldtext = &l:foldtext
|
||||
endif
|
||||
let s:iskeyword = &l:iskeyword
|
||||
|
||||
runtime! syntax/html.vim
|
||||
unlet! b:current_syntax
|
||||
|
||||
syn sync minlines=10
|
||||
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
|
||||
syn case match
|
||||
exe 'syn include @markdownHighlight_'.tr(s:type,'.','_').' 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 spell toplevel
|
||||
if exists('s:foldmethod') && s:foldmethod !=# &l:foldmethod
|
||||
let &l:foldmethod = s:foldmethod
|
||||
unlet s:foldmethod
|
||||
endif
|
||||
if exists('s:foldtext') && s:foldtext !=# &l:foldtext
|
||||
let &l:foldtext = s:foldtext
|
||||
unlet s:foldtext
|
||||
endif
|
||||
if s:iskeyword !=# &l:iskeyword
|
||||
let &l:iskeyword = s:iskeyword
|
||||
endif
|
||||
unlet s:iskeyword
|
||||
|
||||
if !exists('g:markdown_minlines')
|
||||
let g:markdown_minlines = 50
|
||||
endif
|
||||
execute 'syn sync minlines=' . g:markdown_minlines
|
||||
syn sync linebreaks=1
|
||||
syn case ignore
|
||||
|
||||
syn match markdownValid '[<>]\S\@!'
|
||||
syn match markdownValid '&\%(#\=\w*;\)\@!'
|
||||
syn match markdownValid '[<>]\c[a-z/$!]\@!' transparent contains=NONE
|
||||
syn match markdownValid '&\%(#\=\w*;\)\@!' transparent contains=NONE
|
||||
|
||||
syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock
|
||||
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
|
||||
syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError,markdownValid
|
||||
|
||||
syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule
|
||||
syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule
|
||||
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 contained
|
||||
syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained
|
||||
syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained
|
||||
syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained
|
||||
syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained
|
||||
syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained
|
||||
syn region markdownH1 matchgroup=markdownH1Delimiter start=" \{,3}#\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH2 matchgroup=markdownH2Delimiter start=" \{,3}##\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH3 matchgroup=markdownH3Delimiter start=" \{,3}###\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH4 matchgroup=markdownH4Delimiter start=" \{,3}####\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH5 matchgroup=markdownH5Delimiter start=" \{,3}#####\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH6 matchgroup=markdownH6Delimiter start=" \{,3}######\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
|
||||
syn match markdownBlockquote ">\s" contained nextgroup=@markdownBlock
|
||||
syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock
|
||||
|
||||
syn region markdownCodeBlock start=" \|\t" end="$" contained
|
||||
syn region markdownCodeBlock start="^\n\( \{4,}\|\t\)" end="^\ze \{,3}\S.*$" keepend
|
||||
|
||||
" TODO: real nesting
|
||||
syn match markdownListMarker " \{0,4\}[-*+]\%(\s\+\S\)\@=" contained
|
||||
syn match markdownOrderedListMarker " \{0,4}\<\d\+\.\%(\s*\S\)\@=" contained
|
||||
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 "\s\{2,\}$"
|
||||
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
|
||||
@@ -53,22 +101,50 @@ syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+
|
||||
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="\]\%( \=[[(]\)\@=" keepend nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
|
||||
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
|
||||
|
||||
syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart
|
||||
syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart
|
||||
syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart
|
||||
syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart
|
||||
syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart
|
||||
syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart
|
||||
let s:concealends = ''
|
||||
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
|
||||
let s:concealends = ' concealends'
|
||||
endif
|
||||
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\*\S\@=" end="\S\@<=\*\|^$" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
|
||||
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\w\@<!_\S\@=" end="\S\@<=_\w\@!\|^$" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
|
||||
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\*\*\S\@=" end="\S\@<=\*\*\|^$" skip="\\\*" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
|
||||
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\w\@<!__\S\@=" end="\S\@<=__\w\@!\|^$" skip="\\_" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
|
||||
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\*\*\*\S\@=" end="\S\@<=\*\*\*\|^$" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
|
||||
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\w\@<!___\S\@=" end="\S\@<=___\w\@!\|^$" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
|
||||
exe 'syn region markdownStrike matchgroup=markdownStrikeDelimiter start="\~\~\S\@=" end="\S\@<=\~\~\|^$" contains=markdownLineStart,@Spell' . s:concealends
|
||||
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*\zs```\s*\w*\ze\s*$" end="^```\ze\s*$" keepend
|
||||
syn region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
|
||||
syn region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
|
||||
|
||||
syn match markdownEscape "\\[][\\`*_{}()#+.!-]"
|
||||
syn match markdownFootnote "\[^[^\]]\+\]"
|
||||
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
|
||||
|
||||
let s:done_include = {}
|
||||
for s:type in g:markdown_fenced_languages
|
||||
if has_key(s:done_include, matchstr(s:type,'[^.]*'))
|
||||
continue
|
||||
endif
|
||||
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
|
||||
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
|
||||
let s:done_include[matchstr(s:type,'[^.]*')] = 1
|
||||
endfor
|
||||
unlet! s:type
|
||||
unlet! s:done_include
|
||||
|
||||
if get(b:, 'markdown_yaml_head', get(g:, 'markdown_yaml_head', main_syntax ==# 'markdown'))
|
||||
syn include @markdownYamlTop syntax/yaml.vim
|
||||
unlet! b:current_syntax
|
||||
syn region markdownYamlHead start="\%^---$" end="^\%(---\|\.\.\.\)\s*$" keepend contains=@markdownYamlTop,@Spell
|
||||
endif
|
||||
|
||||
syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]"
|
||||
syn match markdownError "\w\@<=_\w\@="
|
||||
|
||||
hi def link markdownH1 htmlH1
|
||||
@@ -78,12 +154,21 @@ hi def link markdownH4 htmlH4
|
||||
hi def link markdownH5 htmlH5
|
||||
hi def link markdownH6 htmlH6
|
||||
hi def link markdownHeadingRule markdownRule
|
||||
hi def link markdownH1Delimiter markdownHeadingDelimiter
|
||||
hi def link markdownH2Delimiter markdownHeadingDelimiter
|
||||
hi def link markdownH3Delimiter markdownHeadingDelimiter
|
||||
hi def link markdownH4Delimiter markdownHeadingDelimiter
|
||||
hi def link markdownH5Delimiter markdownHeadingDelimiter
|
||||
hi def link markdownH6Delimiter markdownHeadingDelimiter
|
||||
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
|
||||
@@ -95,13 +180,21 @@ 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 markdownStrike htmlStrike
|
||||
hi def link markdownStrikeDelimiter markdownStrike
|
||||
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
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
Reference in New Issue
Block a user