From: Hiroshi Shirosaki Date: Thu, 3 Mar 2016 04:27:29 +0000 (+0900) Subject: Fix bug with double underscores X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/1c86478c4a0f641382b1faac1f4d3d25e9fde153?ds=sidebyside;hp=-c Fix bug with double underscores Double underscore inside doesn't make bold. We also fix asterisk and bold italic. Fix #267 --- 1c86478c4a0f641382b1faac1f4d3d25e9fde153 diff --git a/syntax/markdown.vim b/syntax/markdown.vim index d27145c..0dbf49a 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -49,10 +49,10 @@ else endif 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 -execute 'syn region htmlBoldItalic start="\*\*\*\ze\S" end="\S\zs\*\*\*" keepend' . s:oneline -execute 'syn region htmlBoldItalic start="___\ze\S" end="\S\zs___" keepend' . s:oneline +execute 'syn region htmlBold start="\%(^\|\s\)\*\*\ze\S" end="\S\zs\*\*" keepend' . s:oneline +execute 'syn region htmlBold start="\%(^\|\s\)\zs__\ze\S" end="\S\zs__" keepend' . s:oneline +execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs\*\*\*\ze\S" end="\S\zs\*\*\*" keepend' . s:oneline +execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs___\ze\S" end="\S\zs___" keepend' . s:oneline " [link](URL) | [link][id] | [link][] | ![image](URL) syn region mkdFootnotes matchgroup=mkdDelimiter start="\[^" end="\]" diff --git a/test/syntax.vader b/test/syntax.vader index 9559ee3..e36c835 100644 --- a/test/syntax.vader +++ b/test/syntax.vader @@ -154,6 +154,14 @@ Given markdown; Execute (not italic with an asterisk): AssertNotEqual SyntaxOf('a'), 'htmlItalic' +Given markdown; +[__](a) b + +Execute (not bold with double underscores): + AssertNotEqual SyntaxOf('_'), 'htmlBold' + AssertNotEqual SyntaxOf('a'), 'htmlBold' + AssertNotEqual SyntaxOf('b'), 'htmlBold' + # Links Given markdown;