Skip to content

Commit

Permalink
Highlight strikethrough text in headings
Browse files Browse the repository at this point in the history
  • Loading branch information
lggruspe authored and alerque committed Sep 20, 2023
1 parent 18f3af7 commit 6b13e98
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion syntax/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if get(g:, 'vim_markdown_strikethrough', 0)
HtmlHiLink mkdStrike htmlStrike
endif

syn cluster mkdHeadingContent contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdLink,mkdInlineURL
syn cluster mkdHeadingContent contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdLink,mkdInlineURL,mkdStrike
syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath,mkdStrike

"highlighting for Markdown groups
Expand Down
41 changes: 41 additions & 0 deletions test/strikethrough.vader
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Before:
let g:vim_markdown_strikethrough = 1
syn off | syn on

After:
unlet! g:vim_markdown_strikethrough

Given markdown;
a ~~b~~ c

Execute (strikethrough):
AssertNotEqual SyntaxOf('a'), 'mkdStrike'
AssertEqual SyntaxOf('b'), 'mkdStrike'
AssertNotEqual SyntaxOf('c'), 'mkdStrike'

Given markdown;
# ~~h1~~
## ~~h2~~
### ~~h3~~
#### ~~h4~~
##### ~~h5~~
###### ~~h6~~

Execute (strikethrough in atx headings):
AssertEqual SyntaxOf('h1'), 'mkdStrike'
AssertEqual SyntaxOf('h2'), 'mkdStrike'
AssertEqual SyntaxOf('h3'), 'mkdStrike'
AssertEqual SyntaxOf('h4'), 'mkdStrike'
AssertEqual SyntaxOf('h5'), 'mkdStrike'
AssertEqual SyntaxOf('h6'), 'mkdStrike'

Given markdown;
~~h1~~
=

~~h2~~
-

Execute (strikethrough in setext headings):
AssertEqual SyntaxOf('h1'), 'mkdStrike'
AssertEqual SyntaxOf('h2'), 'mkdStrike'

0 comments on commit 6b13e98

Please sign in to comment.