From: Hiroshi Shirosaki Date: Tue, 19 Jan 2016 00:53:32 +0000 (+0900) Subject: First =, - should not be treated as header X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/69c9e5001983d808be2259cd493b99d51ad5d7d3?ds=sidebyside;hp=--cc First =, - should not be treated as header Fix #189 --- 69c9e5001983d808be2259cd493b99d51ad5d7d3 diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 7e06471..63429b3 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -66,6 +66,16 @@ syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained +"HTML headings +syn region htmlH1 start="^\s*#" end="$" contains=@Spell +syn region htmlH2 start="^\s*##" end="$" contains=@Spell +syn region htmlH3 start="^\s*###" end="$" contains=@Spell +syn region htmlH4 start="^\s*####" end="$" contains=@Spell +syn region htmlH5 start="^\s*#####" end="$" contains=@Spell +syn region htmlH6 start="^\s*######" end="$" contains=@Spell +syn match htmlH1 /^.\+\n=\+$/ contains=@Spell +syn match htmlH2 /^.\+\n-\+$/ contains=@Spell + "define Markdown groups syn match mkdLineContinue ".$" contained syn match mkdLineBreak / \+$/ @@ -88,16 +98,6 @@ syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/ syn match mkdRule /^\s*-\{3,}$/ syn match mkdRule /^\s*\*\{3,5}$/ -"HTML headings -syn region htmlH1 start="^\s*#" end="$" contains=@Spell -syn region htmlH2 start="^\s*##" end="$" contains=@Spell -syn region htmlH3 start="^\s*###" end="$" contains=@Spell -syn region htmlH4 start="^\s*####" end="$" contains=@Spell -syn region htmlH5 start="^\s*#####" end="$" contains=@Spell -syn region htmlH6 start="^\s*######" end="$" contains=@Spell -syn match htmlH1 /^.\+\n=\+$/ contains=@Spell -syn match htmlH2 /^.\+\n-\+$/ contains=@Spell - " YAML frontmatter if get(g:, 'vim_markdown_frontmatter', 0) syn include @yamlTop syntax/yaml.vim diff --git a/test/syntax.vader b/test/syntax.vader index ebd197e..7d6f6b1 100644 --- a/test/syntax.vader +++ b/test/syntax.vader @@ -267,6 +267,18 @@ Execute (fenced code block syntax with an unknown language specifier): call b:func(0) AssertEqual SyntaxOf('code'), 'mkdSnippetA_B_' + +Given markdown; +``` += +a +- +``` + +Execute (first = or - in fenced code block is not setex headers): + AssertEqual SyntaxOf('='), 'mkdCode' + AssertEqual SyntaxOf('-'), 'mkdCode' + # Math Given markdown;