mirror of
https://github.com/tpope/vim-markdown.git
synced 2025-11-08 09:53:50 -05:00
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
This commit is contained in:
@@ -75,7 +75,7 @@ syn region markdownH6 matchgroup=markdownH6Delimiter start=" \{,3}######\s" end=
|
|||||||
|
|
||||||
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
|
" TODO: real nesting
|
||||||
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
|
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
|
||||||
|
|||||||
Reference in New Issue
Block a user