preservim / vim-markdown

Markdown Vim Mode
4.68k stars 521 forks source link

Add todo highlighting in the html comments #369

Open dylan-chong opened 6 years ago

dylan-chong commented 6 years ago

If we have some markdown code with an html comment:

<!-- TODO my thing -->

highlight the word TODO

Gidgidonihah commented 5 years ago

I wanted this as well. I ended up setting up something in my vimrc across all files, but before that I attempted this patch:

diff --git i/syntax/markdown.vim w/syntax/markdown.vim
index d8d34ea..d962f6c 100644
--- i/syntax/markdown.vim
+++ w/syntax/markdown.vim
@@ -85,6 +85,9 @@ syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+     end=+"+  contained
 syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+     end=+'+  contained
 syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+     end=+)+  contained

+" Highlight TODO in markdown files
+syn keyword mkdTodo     contained TODO FIXME XXX TBD
+
 "HTML headings
 syn region htmlH1       matchgroup=mkdHeading     start="^\s*#"                   end="$" contains=mkdLink,mkdInlineURL,@Spell
 syn region htmlH2       matchgroup=mkdHeading     start="^\s*##"                  end="$" contains=mkdLink,mkdInlineURL,@Spell
@@ -177,6 +180,7 @@ HtmlHiLink mkdLinkDef       mkdID
 HtmlHiLink mkdLinkDefTarget mkdURL
 HtmlHiLink mkdLinkTitle     htmlString
 HtmlHiLink mkdDelimiter     Delimiter
+HtmlHiLink mkdTodo          Todo

 let b:current_syntax = "mkd"

Which did not work. I'd love to know or how to get it to work, though.