I decide to learn more about vim and its syntax highlighting. Using examples for others, I am creating my own syntax file for Markdown. I have seen mkd.vim and it has this problem too. My issue is between list items and code block highlighting.
Code Block definition:
- first line is blank
- second line begins with at least 4 spaces or 1 tab
- block is finished with a blank line
Example:
Regular text
this is code, monospaced and left untouched by markdown
another line of code
Regular Text
My Vim syntax for code block:
syn match mkdCodeBlock /\(\s\{4,}\|\t\{1,}\).*\n/ contained nextgroup=mkdCodeBlock
hi link mkdCodeBlock comment
Unorder List item definition:
- first line is blank
- second line begins with a [-+*] followed by a space
- the list is finished with a blank line then a normal (non-list) line
- in between line items any number of blank lines can be added
- a sub list is specified by indenting (4 space or 1 tab)
- a line of normal text after a list item is include as a continuation of that list item
Example:
Regular text
- item 1
- sub item 1
- sub item 2
- item 2
this is part of item 2
so is this
- item 3, still in the same list
- sub item 1
- sub item 2
Regular text, list ends above
My Vim syntax for unorder list item definition (I only highlight [-+*]):
syn region mkdListItem start=/\s*[-*+]\s\+/ matchgroup=pdcListText end=".*" contained nextgroup=mkdListItem,mkdListSkipNL contains=@Spell skipnl
syn match mkdListSkipNL /\