├── README.markdown └── after └── syntax └── markdown.vim /README.markdown: -------------------------------------------------------------------------------- 1 | # Vim Markdown Extras 2 | 3 | by Matthew Lyon 4 | 5 | Support for various markdown extras that enhance your existing markdown syntax. 6 | 7 | ## Enhance, not replace 8 | 9 | While looking for vim syntax support for things like [MultiMarkdown][mmd] 10 | or [CriticMarkup][crit], instead of *enhancements* that augmented an 11 | existing markdown syntax file, I instead found ones that either *replaced* 12 | the existing syntax file or required the use of custom extensions and used 13 | non-standard file types. 14 | 15 | If you work with more than one of these extensions or other tools that 16 | require an extension such as `.md` or `.markdown`, those solutions are 17 | unworkable. 18 | 19 | Thankfully, vim allows for syntax augmentation through `/syntax/after`. 20 | This plugin is a collection of syntax declarations that work with your 21 | existing markdown syntax to provide highlight groups for non-standard 22 | markdown enhancements. 23 | 24 | ## Currently Supported 25 | 26 | ### [MultiMarkdown][mmd]: 27 | - Syntax Highlighting 28 | - Tables 29 | - Footnote Delimiters 30 | 31 | ### [CriticMarkup][crit], Extensions for Collaboration: 32 | - Syntax Highlighting 33 | - Additions 34 | - Deletions 35 | - Substitutions 36 | - Highlights 37 | - Comments 38 | 39 | ## Coming Soon 40 | - [MultiMarkdown][mmd] definition lists, etc 41 | - Snippets for working with tables, critic Markup 42 | - functions for workflow with critic markup 43 | 44 | [crit]: http://criticmarkup.com/ 45 | [mmd]: https://github.com/fletcher/MultiMarkdown 46 | 47 | -------------------------------------------------------------------------------- /after/syntax/markdown.vim: -------------------------------------------------------------------------------- 1 | 2 | " multi-markdown 3 | " 4 | " Syntax Guide: 5 | " https://github.com/fletcher/MultiMarkdown/wiki/MultiMarkdown-Syntax-Guide 6 | " 7 | " Tables 8 | syn region mmdTable start="^\%(\[.*\]\n\)\{}.*|.*\n[-|\:\. ]\+$" end="\%(\n\[.*\]\n\)\{}\ze\n[^|]\+\n$" keepend contains=mmdTableHeader,mmdTableHeadDelimiter,mmdTableDelimiter,mmdTableCaption 9 | syn match mmdTableDelimiter "|" contained 10 | syn match mmdTableAlign "[\.:]" contained 11 | syn region mmdTableHeader start="^\zs.*\ze\n[-|\:\. ]\+$" end="$" nextgroup=mmdTableHeadDelimiter contained contains=mmdTableDelimiter 12 | syn match mmdTableHeadDelimiter "^[-|\:\.\ ]\+$" contained contains=mmdTableDelimiter,mmdTableAlign 13 | syn region mmdTableCaption matchgroup=mmdTableCaptionDelimiter start="^\[" end="\]$" keepend contained 14 | 15 | hi! link mmdTableHeader Constant 16 | hi! link mmdTableDelimiter Delimiter 17 | hi! link mmdTableAlign Identifier 18 | hi! link mmdTableHeadDelimiter Delimiter 19 | hi! link mmdTableCaptionDelimiter Delimiter 20 | hi! link mmdTableCaption Comment 21 | 22 | " footnotes 23 | syn region mmdFootnoteMarker matchgroup=mmdFootnoteDelimiter start="\[^" end="\]" keepend 24 | hi! link mmdFootnoteDelimiter Delimiter 25 | hi! link mmdFootnoteMarker Constant 26 | 27 | " CriticMarkup 28 | " reference: http://criticmarkup.com 29 | syn region mdCriticAddition matchgroup=mdCriticAdd start=/{++/ end=/++}/ contains=mdCriticAddStartMark, mdCriticAddEndMark concealends 30 | syn match mdCriticAddStartMark /{++/ contained conceal 31 | syn match mdCriticAddEndMark /++}/ contained conceal 32 | syn region mdCriticDeletion matchgroup=mdCriticDel start=/{--/ end=/--}/ contains=mdCriticDelStartMark,mdCriticDelEndMark concealends 33 | syn match mdCriticDelStartMark /{--/ contained conceal 34 | syn match mdCriticDelEndMark /--}/ contained conceal 35 | syn region mdCriticSubRemove start=/{\~\~/ end=/.\(\~>\)\@=/ keepend 36 | syn match mdCriticSubStartMark /{\~\~/ contained containedin=mdCriticSubRemove conceal 37 | syn region mdCriticSubstitute start=/\~>/ end=/\~\~}/ keepend 38 | syn match mdCriticSubTransMark /\~>/ contained containedin=mdCriticSubstitute conceal 39 | syn match mdCriticSubEndMark /\~\~}/ contained containedin=mdCriticSubstitute conceal 40 | syn region mdCriticComment matchgroup=mdCriticExtra start=/{>>/ end=/<<}/ concealends 41 | syn region mdCriticHighlight matchgroup=mdCriticExtra start=/{==/ end=/==}/ concealends 42 | 43 | hi! link mdCriticAdd DiffText 44 | hi! link mdCriticAddition DiffAdd 45 | hi! link mdCriticDel DiffText 46 | hi! link mdCriticDeletion DiffDelete 47 | hi! link mdCriticSubRemove DiffDelete 48 | hi! link mdCriticSubstitute DiffAdd 49 | hi! link mdCriticSubStartMark DiffText 50 | hi! link mdCriticSubTransMark DiffText 51 | hi! link mdCriticSubEndMark DiffText 52 | hi! link mdCriticComment Comment 53 | hi! link mdCriticHighlight Todo 54 | hi! link mdCriticExtra DiffText 55 | 56 | 57 | --------------------------------------------------------------------------------