Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Todo highlighting in html comments #642

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ftplugin/markdown.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"TODO print messages when on visual mode. I only see VISUAL, not the messages.

" Function interface phylosophy:
" Function interface philosophy:
"
" - functions take arbitrary line numbers as parameters.
" Current cursor line is only a suitable default parameter.
Expand Down Expand Up @@ -56,7 +56,7 @@ let s:levelRegexpDict = {
\ 6: '\v^######[^#]@='
\ }

" Maches any header level of any type.
" Matches any header level of any type.
"
" This could be deduced from `s:levelRegexpDict`, but it is more
" efficient to have a single regexp for this.
Expand Down
2 changes: 2 additions & 0 deletions syntax/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*\(\*\|\s\)*$/
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-\(-\|\s\)*$/
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_\(_\|\s\)*$/
syn keyword mkdTodo TODO FIXME XXX TBD contained containedin=htmlComment,htmlCommentPart

" YAML frontmatter
if get(g:, 'vim_markdown_frontmatter', 0)
Expand Down Expand Up @@ -180,6 +181,7 @@ HtmlHiLink mkdLinkDef mkdID
HtmlHiLink mkdLinkDefTarget mkdURL
HtmlHiLink mkdLinkTitle htmlString
HtmlHiLink mkdDelimiter Delimiter
HtmlHiLink mkdTodo Todo

let b:current_syntax = 'mkd'

Expand Down
37 changes: 37 additions & 0 deletions test/syntax.vader
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,43 @@ Execute (HTML tag in text):
AssertEqual SyntaxOf('<span>'), 'htmlTag'
AssertEqual SyntaxOf('</span>'), 'htmlEndTag'

Given markdown;
<!-- TODO FIXME XXX TBD hello -->

Execute (todo inside HTML comment):
AssertEqual SyntaxOf('TODO'), 'mkdTodo'
AssertEqual SyntaxOf('FIXME'), 'mkdTodo'
AssertEqual SyntaxOf('XXX'), 'mkdTodo'
AssertEqual SyntaxOf('TBD'), 'mkdTodo'
AssertNotEqual SyntaxOf('hello'), 'mkdTodo'

Given markdown;
<!-- ATODO BFIXME CXXX DTBD -->

Execute (fake todo inside HTML comment):
AssertNotEqual SyntaxOf('TODO'), 'mkdTodo'
AssertNotEqual SyntaxOf('FIXME'), 'mkdTodo'
AssertNotEqual SyntaxOf('XXX'), 'mkdTodo'
AssertNotEqual SyntaxOf('TBD'), 'mkdTodo'
lggruspe marked this conversation as resolved.
Show resolved Hide resolved

Given markdown;
TODO FIXME XXX TBD

Execute (todo outside HTML comment):
AssertNotEqual SyntaxOf('TODO'), 'mkdTodo'
AssertNotEqual SyntaxOf('FIXME'), 'mkdTodo'
AssertNotEqual SyntaxOf('XXX'), 'mkdTodo'
AssertNotEqual SyntaxOf('TBD'), 'mkdTodo'

Given markdown;
> TODO FIXME XXX TBD

Execute (todo inside non-HTML comment):
AssertNotEqual SyntaxOf('TODO'), 'mkdTodo'
AssertNotEqual SyntaxOf('FIXME'), 'mkdTodo'
AssertNotEqual SyntaxOf('XXX'), 'mkdTodo'
AssertNotEqual SyntaxOf('TBD'), 'mkdTodo'

Given markdown;
# _h1_

Expand Down
Loading