From 2e524e474d37fe4da0960043d0a46192b297837c Mon Sep 17 00:00:00 2001 From: Hiroshi Shirosaki Date: Fri, 22 Jan 2016 09:49:37 +0900 Subject: [PATCH 1/1] Escaped pre and code should not be code block Fix #111 --- syntax/markdown.vim | 4 ++-- test/syntax.vader | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) 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; -- 2.39.5