From 1bdd9c799b74a6443c0c3875dedcd5f33d25772c Mon Sep 17 00:00:00 2001 From: Hiroshi Shirosaki Date: Fri, 19 Feb 2016 15:27:16 +0900 Subject: [PATCH] Not highlight as italic without asterisk end Fix #260 --- syntax/markdown.vim | 2 +- test/syntax.vader | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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; -- 2.39.5