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=/\(^\|\s\)\*\@<!\*\*\*\@!/ end=/\*\@<!\*\*\*\@!\($\|\s\)/ contains=@Spell,htmlItalic
41 syn region htmlItalic start=/\(^\|\s\)\*\@<!\*\*\@!/ end=/\*\@<!\*\*\@!\($\|\s\)/ contains=htmlBold,@Spell
42 syn region htmlBold start=/\(^\|\s\)_\@<!___\@!/ end=/_\@<!___\@!\($\|\s\)/ contains=htmlItalic,@Spell
43 syn region htmlItalic start=/\(^\|\s\)_\@<!__\@!/ end=/_\@<!__\@!\($\|\s\)/ 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]\+\)[^*-+ ].*\n\)\+/
58 syn region mkdCode start=/`/ end=/`/
59 syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
60 syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLineContinue,@Spell
61 syn region mkdCode start="<pre[^>]*>" end="</pre>"
62 syn region mkdCode start="<code[^>]*>" end="</code>"
65 syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell
66 syn region htmlH2 start="^\s*##" end="\($\|#\+\)" contains=@Spell
67 syn region htmlH3 start="^\s*###" end="\($\|#\+\)" contains=@Spell
68 syn region htmlH4 start="^\s*####" end="\($\|#\+\)" contains=@Spell
69 syn region htmlH5 start="^\s*#####" end="\($\|#\+\)" contains=@Spell
70 syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contains=@Spell
71 syn match htmlH1 /^.\+\n=\+$/ contains=@Spell
72 syn match htmlH2 /^.\+\n-\+$/ contains=@Spell
74 "highlighting for Markdown groups
75 HtmlHiLink mkdString String
76 HtmlHiLink mkdCode String
77 HtmlHiLink mkdBlockquote Comment
78 HtmlHiLink mkdLineContinue Comment
79 HtmlHiLink mkdListItem Identifier
80 HtmlHiLink mkdRule Identifier
83 let b:current_syntax = "mkd"