From: Hiroshi Shirosaki Date: Fri, 19 Feb 2016 06:27:16 +0000 (+0900) Subject: Not highlight as italic without asterisk end X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/1bdd9c799b74a6443c0c3875dedcd5f33d25772c?ds=inline;hp=-c Not highlight as italic without asterisk end Fix #260 --- 1bdd9c799b74a6443c0c3875dedcd5f33d25772c diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 52369c3..a8f93bc 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -47,7 +47,7 @@ if get(g:, 'vim_markdown_emphasis_multiline', 1) else let s:oneline = ' oneline' endif -execute 'syn region htmlItalic start="\%(^\|\s\)\zs\*\ze[^\\\*\t ]" end="[^\\\*\t ]\zs\*\ze\_W" keepend' . s:oneline +execute 'syn region htmlItalic start="\%(^\|\s\)\zs\*\ze[^\\\*\t ]\%(\%([^*]\|\\\*\|\n\)*[^\\\*\t ]\)\?\*\_W" end="[^\\\*\t ]\zs\*\ze\_W" keepend' . s:oneline execute 'syn region htmlItalic start="\%(^\|\s\)\zs_\ze[^\\_\t ]" end="[^\\_\t ]\zs_\ze\_W" keepend' . s:oneline execute 'syn region htmlBold start="\*\*\ze\S" end="\S\zs\*\*" keepend' . s:oneline execute 'syn region htmlBold start="__\ze\S" end="\S\zs__" keepend' . s:oneline diff --git a/test/syntax.vader b/test/syntax.vader index fda56e0..9559ee3 100644 --- a/test/syntax.vader +++ b/test/syntax.vader @@ -148,6 +148,12 @@ Execute (bold italic with asterisks in multiple lines): AssertEqual SyntaxOf('c'), 'htmlBoldItalic' AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic' +Given markdown; +*a + +Execute (not italic with an asterisk): + AssertNotEqual SyntaxOf('a'), 'htmlItalic' + # Links Given markdown;