From: Hiroshi Shirosaki Date: Fri, 22 Jan 2016 00:49:37 +0000 (+0900) Subject: Escaped pre and code should not be code block X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/2e524e474d37fe4da0960043d0a46192b297837c?ds=sidebyside Escaped pre and code should not be code block Fix #111 --- diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 186216e..599b334 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -91,8 +91,8 @@ syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/ syn region mkdCode start=/^\s*\z(`\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1`*\s*$/ syn region mkdCode start=/\s*\~\~[^\~]*/ end=/[^\~]*\~\~\s*/ syn region mkdCode start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/ -syn region mkdCode start="]*>" end="" -syn region mkdCode start="]*>" end="" +syn region mkdCode start="]*\\\@" end="" +syn region mkdCode start="]*\\\@" end="" syn region mkdFootnote start="\[^" end="\]" syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/ syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ diff --git a/test/syntax.vader b/test/syntax.vader index f2fc936..c55ce76 100644 --- a/test/syntax.vader +++ b/test/syntax.vader @@ -395,6 +395,40 @@ Execute (first = or - in fenced code block is not setex headers): AssertEqual SyntaxOf('='), 'mkdCode' AssertEqual SyntaxOf('-'), 'mkdCode' +# Code Blocks in pre and code tag + +Given markdown; +
+a
+
+ +Execute (code block in pre tag): + AssertEqual SyntaxOf('a'), 'mkdCode' + +Given markdown; + +a + + +Execute (code block in code tag): + AssertEqual SyntaxOf('a'), 'mkdCode' + +Given markdown; +\ +a +\ + +Execute (not code block in escaped pre tag): + AssertNotEqual SyntaxOf('a'), 'mkdCode' + +Given markdown; +\ +a +\ + +Execute (not code block in escaped code tag): + AssertNotEqual SyntaxOf('a'), 'mkdCode' + # Math Given markdown;