Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/vim-markdown.txt
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ The following requires ':filetype plugin on'.
*:Tocv*
- ':Tocv': Same as ':Toc' for symmetry with ':Toch' and ':Tocv'.

*:MarkdownRefreshSyntax*
- ':MarkdownRefreshSyntax': re-apply syntax recognition. Normally it happens
automatically; but occasionally you might need to trigger it manually.

===============================================================================
*vim-markdown-credits*
Credits ~
Expand Down
5 changes: 3 additions & 2 deletions ftplugin/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ command! -buffer Toc call s:Toc()
command! -buffer Toch call s:Toc('horizontal')
command! -buffer Tocv call s:Toc('vertical')
command! -buffer Toct call s:Toc('tab')
command! -buffer MarkdownRefreshSyntax call s:MarkdownRefreshSyntax(1)

" Heavily based on vim-notes - http://peterodding.com/code/vim/notes/
if exists('g:vim_markdown_fenced_languages')
Expand All @@ -655,7 +656,7 @@ function! s:MarkdownHighlightSources(force)
" Look for code blocks in the current file
let filetypes = {}
for line in getline(1, '$')
let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*')
let ft = matchstr(line, '\v(```|\~\~\~)\s*(\{\.?)?\zs[0-9A-Za-z_+-]*\ze')
if !empty(ft) && ft !~ '^\d*$' | let filetypes[ft] = 1 | endif
endfor
if !exists('b:mkd_known_filetypes')
Expand Down Expand Up @@ -686,7 +687,7 @@ function! s:MarkdownHighlightSources(force)
else
let include = '@' . toupper(filetype)
endif
let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
let command = 'syntax region %s matchgroup=%s start="\v^\s*(```|\~\~\~)\s*(\{\.?)?%s.*$" matchgroup=%s end="\v\s*(```|\~\~\~)$" keepend contains=%s%s'
execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) ? ' concealends' : '')
execute printf('syntax cluster mkdNonListItem add=%s', group)

Expand Down