All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
3 " Maintainer: Ben Williams <benw@plasticboy.com>
4 " URL: http://plasticboy.com/markdown-vim-mode/
6 " Last Change: 2008 April 29
7 " Remark: Uses HTML syntax file
8 " Remark: I don't do anything with angle brackets (<>) because that would too easily
9 " easily conflict with HTML syntax
10 " TODO: Do something appropriate with image syntax
11 " TODO: Handle stuff contained within stuff (e.g. headings within blockquotes)
14 " Read the HTML syntax to start with
16 so <sfile>:p:h/html.vim
18 runtime! syntax/html.vim
19 unlet b:current_syntax
24 elseif exists("b:current_syntax")
28 " don't use standard HiLink, it will not work with included syntax files
30 command! -nargs=+ HtmlHiLink hi link <args>
32 command! -nargs=+ HtmlHiLink hi def link <args>
39 "additions to HTML groups
40 syn region htmlBold start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\*\@!/ end=/\\\@<!\*\@<!\*\*\*\@!\($\|\A\)\@=/ contains=@Spell,htmlItalic
41 syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\@!/ end=/\\\@<!\*\@<!\*\*\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
42 syn region htmlBold start=/\\\@<!\(^\|\A\)\@=_\@<!___\@!/ end=/\\\@<!_\@<!___\@!\($\|\A\)\@=/ contains=htmlItalic,@Spell
43 syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=_\@<!__\@!/ end=/\\\@<!_\@<!__\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
44 syn region htmlString start="]("ms=s+2 end=")"me=e-1
45 syn region htmlLink start="\\\@<!\["ms=s+1 end="\\\@<!\]"me=e-1 contains=@Spell
46 syn region htmlString start="\(\[.*]: *\)\@<=.*" end="$"
48 "define Markdown groups
49 syn match mkdLineContinue ".$" contained
50 syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
51 syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
52 syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
53 syn match mkdRule /^\s*-\{3,}$/
54 syn match mkdRule /^\s*\*\{3,5}$/
55 syn match mkdListItem "^\s*[-*+]\s\+"
56 syn match mkdListItem "^\s*\d\+\.\s\+"
57 syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
58 syn match mkdLineBreak / \+$/
59 syn region mkdCode start=/\\\@<!`/ end=/\\\@<!`/
60 syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
61 syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell
62 syn region mkdCode start="<pre[^>]*>" end="</pre>"
63 syn region mkdCode start="<code[^>]*>" end="</code>"
66 syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell
67 syn region htmlH2 start="^\s*##" end="\($\|#\+\)" contains=@Spell
68 syn region htmlH3 start="^\s*###" end="\($\|#\+\)" contains=@Spell
69 syn region htmlH4 start="^\s*####" end="\($\|#\+\)" contains=@Spell
70 syn region htmlH5 start="^\s*#####" end="\($\|#\+\)" contains=@Spell
71 syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contains=@Spell
72 syn match htmlH1 /^.\+\n=\+$/ contains=@Spell
73 syn match htmlH2 /^.\+\n-\+$/ contains=@Spell
75 "highlighting for Markdown groups
76 HtmlHiLink mkdString String
77 HtmlHiLink mkdCode String
78 HtmlHiLink mkdBlockquote Comment
79 HtmlHiLink mkdLineContinue Comment
80 HtmlHiLink mkdListItem Identifier
81 HtmlHiLink mkdRule Identifier
82 HtmlHiLink mkdLineBreak Todo
84 let b:current_syntax = "mkd"