44 Commits

Author SHA1 Message Date
Scott Olsen
bb5a651b3b Merge de0456245c into f405b47fd8 2024-05-28 11:09:14 +02:00
Tim Pope
f405b47fd8 Don't allow space between link text and URL
Resolves: https://github.com/tpope/vim-markdown/issues/212
2024-05-25 23:38:54 -04:00
flyxyz123
f2b82b7884 Fix fold inside code fences 2023-04-02 13:30:41 -04:00
Tim Pope
feadbc81e2 Vim 9.0.0772 2022-10-16 16:44:22 -04:00
Tim Pope
a282dd89fb Remove spurious blank line 2022-10-13 00:06:05 -04:00
Tim Pope
b78bbce337 Add recommended styles, per modern runtime file idiom
Both the original spec on Daring Fireball and the more rigorous
CommonMark spec state that a tab at the beginning of the line is
synonymous with 4 spaces.  For the record, I think this was a mistake,
but if you can't beat 'em, join 'em.
2022-04-02 15:40:07 -04:00
Tim Pope
b52c46dd8e Support YAML metadata
Resolves: https://github.com/tpope/vim-markdown/issues/71
2022-03-18 17:35:23 -04:00
Tim Pope
6be354e576 Allow fenced languages when embedding in another language
Resolves: https://github.com/tpope/vim-liquid/issues/15
2022-03-18 16:40:50 -04:00
Tim Pope
ff1caeadba Use "_" in generated identifiers rather than smooshing 2022-03-18 16:40:50 -04:00
Joseph Adams
891dff54a9 Adding strikethrough support via the htmlStrike highlight group
Co-authored-by: Rodrigo Haenggi <rodrigo@codegestalt.com>
2022-01-24 13:18:41 -05:00
Jaehwang Jerry Jung
59a551feb2 Don't let emphasis span multiple paragraphs
Most markdown implementations do not allow emphasis to span multiple
paragraphs. For example, commonmark.js, Markdown.pl, pandoc, and
Python-Markdown compile the following markdown

```markdown
*asdf

asdf*
```

to

```html
<p>*asdf</p>
<p>asdf*</p>
```

Some implementations compile it to

```html
<p><em>asdf</em></p>
<p>asdf*</p>
```

See https://johnmacfarlane.net/babelmark2/?normalize=1&text=*asdf%0A%0Aasdf*

Adding "^$" to :syn-end makes the emphasis end at an empty line like the
second compiled HTML above. While not perfect, it prevents an unmatched
`*` from emphasizing the entirety of the following text.
2022-01-12 12:33:36 -05:00
Jaehwang Jerry Jung
ec486958ea Require no space after/before emphasis delimiter
Many markdown implementations require that `*` be not followed (resp.
preceded) by whitespace to open (resp. close) emphasis. For example,
commonmark.js, Markdown.pl, and pandoc compile the follow markdown

```markdown
a* asdf *a
```

to

```html
<p>a* asdf *a</p>
```

On the other hand, Python-Markdown allows whitespace:

```html
<p>a<em> asdf </em>a</p>
```

See https://johnmacfarlane.net/babelmark2/?normalize=1&text=a*+asdf+*a

Since variants of commonmark (including GFM) are prevalent these days,
it makes more sense to follow the first behavior.
2022-01-12 12:33:36 -05:00
Jaehwang Jerry Jung
db82f00b58 Don't let fenced languages change 'iskeyword' 2022-01-11 10:07:50 -05:00
Jaehwang Jerry Jung
c7988e88a2 Don't let fenced languages disable spell checking 2022-01-11 10:07:50 -05:00
Jaehwang Jerry Jung
e2acae8cef Run :syn case match before :syn include
Syntax scripts for html and some other languages run :syn case ignore.
This may break syntax scripts of other fenced languages that implicitly
assume :syn case match.
2022-01-11 10:07:50 -05:00
Jaehwang Jerry Jung
23213f39db Fix undo_ftplugin
Add the missing bar and setl command, which previously hadn't been
necessary until the addition of [[ and ]] maps.
2022-01-10 12:09:22 -05:00
Tim Pope
ed76403b2e Change from email to URL 2021-09-13 19:13:50 -04:00
Tim Pope
82a10f4137 Always indent 4 spaces after reference-style link
References: https://github.com/vim/vim/pull/8859
2021-09-13 18:44:46 -04:00
Tim Pope
addd5abaa6 Add :syn sync linebreaks=1 to improve consistency
This was reported to fix a folding issue I can't reproduce, and also
fixes some inconsistencies such as an underline style heading failing to
highlight until a redraw.

Resolves: https://github.com/tpope/vim-markdown/issues/179
2021-06-19 13:43:31 -04:00
flyxyz123
3cdd8a9b76 Fix folding of headers adjacent to code blocks
Resolves: https://github.com/tpope/vim-markdown/issues/177
2021-06-19 13:15:26 -04:00
Anthony Geoghegan
9d87cc1917 Prevent false detection of fenced code block start
If a line begins with a word that matches one of the languages listed in
`g:markdown_fenced_languages`, the line is wrongly detected as being the
start of a fenced code block for that language. This commit ensures that
a line is only treated as the start of fenced code block if the line
begins with three or more consecutive backtick or tilde characters (with
optional leading space characters).
2021-04-21 11:29:46 -04:00
Tim Pope
855b8915e0 Do the right thing for g:markdown_folding == 0 2021-03-11 13:29:54 -05:00
Zach Himsel
65cb65a31a Use markdownCodeBlock for fenced code block regions
Given that there are two separate syntax groups for code and code
blocks, it makes sense to have the triple-backtick/tilde fenced code
blocks be labeled as such.
2021-03-10 15:30:11 -05:00
Zach Himsel
f08447c76b Fix region detection for indented code blocks
Prior to this commit, _any_ line that started with at least 4 spaces or
a tab would be considered a code block.

For example, the third level of a 2-space-indented list would be
highlighted as code, not as list items.

Note: this conforms to the original Markdown spec:
> To produce a code block in Markdown, simply indent every line of the
> block by at least 4 spaces or 1 tab.
> A code block continues until it reaches a line that is not indented
> (or the end of the article).

While this doesn't explicitly state that a blank line _before_ the code
block is required, in practical testing, it is. As such, I've included
the requirement of a blank line preceeding the indent to match the
region start.

Any line not indented by at least 4 spaces will end the region.

Closes https://github.com/tpope/vim-markdown/issues/81
Closes https://github.com/tpope/vim-markdown/issues/164
Closes https://github.com/tpope/vim-markdown/issues/94 (possibly)
Closes https://github.com/tpope/vim-markdown/pull/140
2021-03-10 15:30:11 -05:00
Konfekt
baf2592d33 Don't let fenced languages change &foldtext
Addresses the sequel to issue #154.
See https://github.com/tpope/vim-markdown/issues/154#issuecomment-778677280
2021-02-15 14:32:45 -05:00
Tim Pope
276524ed9c Mitigate performance issue with link text
References https://github.com/vim/vim/issues/6777
2020-09-08 00:19:09 -04:00
Ash Holland
a1ed88889c Recognise indented bulleted lists for wrapping 2020-09-04 18:34:22 -04:00
Greg Anders
9ff8d52c78 Update header pattern to include trailing space or tab (#168) 2020-07-24 00:40:03 -04:00
Scott Olsen
de0456245c A few more cosmetic updates to README 2020-04-16 17:30:31 -04:00
Scott Olsen
a88cfb6fc2 Merge branch 'master' of https://github.com/tpope/vim-markdown into readme-update 2020-04-16 17:28:06 -04:00
Tim Pope
296eeaa887 Support tilde code blocks
Also ensure the end marker has the same number of delimiter characters
as the start marker.

Closes https://github.com/tpope/vim-markdown/issues/156
2020-02-21 00:25:51 -05:00
Greg Anders
f35c43c535 Update [[ and ]] mappings
1. Add support for setext style headings
2. Use the 's' flag in search() to set the ' mark instead of using m'
3. Fix the guard
2020-02-01 11:47:08 -05:00
Tim Pope
6c4c60fbaa Also don't let HTML and dependent syntaxes change 'foldmethod'
References https://github.com/tpope/vim-markdown/issues/154
2020-01-30 12:56:09 -05:00
Tim Pope
719b046bbe Don't let fenced language syntaxes change 'foldmethod'
Closes https://github.com/tpope/vim-markdown/issues/154
2020-01-30 12:45:09 -05:00
Tim Pope
191438f358 Add [[ and ]] maps
Hat tip to Joe Reynolds for the idea.
2020-01-30 11:57:41 -05:00
Tim Pope
4e25b2f606 Vim 8.2.0141 2020-01-30 11:50:49 -05:00
Tim Pope
e875717243 Fix closing italics
Closes https://github.com/tpope/vim-markdown/issues/151
2019-12-12 13:55:26 -05:00
Scott Olsen
5e1ac0ee60 Merge branch 'master' into readme-update 2019-04-16 17:28:02 -04:00
Scott Olsen
8946b2ecc1 Add section headers. 2018-10-22 15:23:08 -04:00
Scott Olsen
c74710e89b Add a configuration header. 2018-10-22 15:17:38 -04:00
Scott Olsen
d6012fe996 Make vimrc mentions consistent. Fix minor typos. 2018-10-22 15:16:45 -04:00
Scott Olsen
d7053febeb Update the fenced codeblocks documentation. 2018-10-22 15:09:43 -04:00
Scott Olsen
4831a1241c Update the minlines section content; typos, grammar, etc. 2018-10-22 15:04:09 -04:00
Scott Olsen
6f6ff4c922 Add documentation on enabling folding. 2018-10-22 15:00:39 -04:00
3 changed files with 113 additions and 46 deletions

View File

@@ -1,25 +1,43 @@
# 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
filetype plugins for Markdown. Generally you don't need to install these if
you are running a recent version of Vim.
If you want to enable fenced code block syntax highlighting in your markdown
documents you can enable it in your `.vimrc` like so:
## 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']
To disable markdown syntax concealing add the following to your vimrc:
**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
Syntax highlight is synchronized in 50 lines. It may cause collapsed
highlighting at large fenced code block.
In the case, please set larger value in your vimrc:
### 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 that setting too large value may cause bad performance on highlighting.
**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

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Markdown
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2019 Dec 05
" Language: Markdown
" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
" Last Change: 2022 Oct 13
if exists("b:did_ftplugin")
finish
@@ -9,18 +9,33 @@ endif
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
let s:keepcpo= &cpo
set cpo&vim
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}
if exists('b:undo_ftplugin')
let b:undo_ftplugin .= "|setl cms< com< fo< flp<"
let b:undo_ftplugin .= "|setl cms< com< fo< flp< et< ts< sts< sw<"
else
let b:undo_ftplugin = "setl cms< com< fo< flp<"
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(v:lnum, 1, 1), 'name') !=# 'markdownCode'
return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCodeBlock'
endfunction
function! MarkdownFold() abort
@@ -64,11 +79,14 @@ function! MarkdownFoldText() abort
return hash_indent.' '.title.' '.linecount
endfunction
if has("folding") && exists("g:markdown_folding")
if has("folding") && get(g:, "markdown_folding", 0)
setlocal foldexpr=MarkdownFold()
setlocal foldmethod=expr
setlocal foldtext=MarkdownFoldText()
let b:undo_ftplugin .= " foldexpr< foldmethod< foldtext<"
let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
endif
let &cpo = s:keepcpo
unlet s:keepcpo
" vim:set sw=2:

View File

@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Markdown
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
" Filenames: *.markdown
" Last Change: 2019 Dec 05
" Last Change: 2022 Oct 13
if exists("b:current_syntax")
finish
@@ -12,6 +12,12 @@ 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
@@ -26,17 +32,33 @@ for s:type in map(copy(g:markdown_fenced_languages),'matchstr(v:val,"[^=]*$")')
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'
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 '[<>]\c[a-z/$!]\@!' transparent contains=NONE
@@ -52,16 +74,16 @@ syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHea
syn match markdownHeadingRule "^[=-]\+$" contained
syn region markdownH1 matchgroup=markdownH1Delimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH2 matchgroup=markdownH2Delimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH3 matchgroup=markdownH3Delimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH4 matchgroup=markdownH4Delimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH5 matchgroup=markdownH5Delimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH6 matchgroup=markdownH6Delimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink 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 region markdownCodeBlock start=" \|\t" end="$" contained
syn region markdownCodeBlock start="^\n\( \{4,}\|\t\)" end="^\ze \{,3}\S.*$" keepend
" TODO: real nesting
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
@@ -79,7 +101,7 @@ 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="\]\%( \=[[(]\)\@=" 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
@@ -88,31 +110,38 @@ 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\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\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\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\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\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\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 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*````*.*$" end="^\s*````*\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 markdownFootnote "\[^[^\]]\+\]"
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
if main_syntax ==# 'markdown'
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*````*\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*````*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') . s:concealends
let s:done_include[matchstr(s:type,'[^.]*')] = 1
endfor
unlet! s:type
unlet! s:done_include
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 "\\[][\\`*_{}()<>#+.!-]"
@@ -156,6 +185,8 @@ 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