+Given markdown;
+a (http://b.bb) c
+
+Execute (autolink in parenthesis):
+ AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('('), 'mkdDelimiter'
+ AssertEqual SyntaxOf('b'), 'mkdInlineURL'
+ AssertEqual SyntaxOf(')'), 'mkdDelimiter'
+ AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
+
+Given markdown;
+[![a](http://b)](http://c)
+
+Execute (autolink in link text):
+ AssertEqual SyntaxOf('!'), 'mkdDelimiter'
+ AssertEqual SyntaxOf('a'), 'mkdLink'
+ AssertEqual SyntaxOf('b'), 'mkdURL'
+ AssertEqual SyntaxOf('c'), 'mkdURL'
+
+Given markdown;
+# [h1link](url)
+
+## [h2link](url)
+
+### [h3link](url)
+
+#### [h4link](url)
+
+##### [h5link](url)
+
+###### [h6link](url)
+
+[h1link_b](url)
+===============
+
+[h2link_b](url)
+---------------
+
+Execute (link in headers):
+ AssertEqual SyntaxOf('h1link'), 'mkdLink'
+ AssertEqual SyntaxOf('h2link'), 'mkdLink'
+ AssertEqual SyntaxOf('h3link'), 'mkdLink'
+ AssertEqual SyntaxOf('h4link'), 'mkdLink'
+ AssertEqual SyntaxOf('h5link'), 'mkdLink'
+ AssertEqual SyntaxOf('h6link'), 'mkdLink'
+ AssertEqual SyntaxOf('h1link_b'), 'mkdLink'
+ AssertEqual SyntaxOf('h2link_b'), 'mkdLink'
+
+Given markdown;
+# http://h1link.foo
+
+## http://h2link.foo
+
+### http://h3link.foo
+
+#### http://h4link.foo
+
+##### http://h5link.foo
+
+###### http://h6link.foo
+
+http://h1link_b.foo
+===================
+
+http://h2link_b.foo
+-------------------
+
+Execute (inline url in headers):
+ AssertEqual SyntaxOf('h1link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h2link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h3link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h4link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h5link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h6link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h1link_b'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h2link_b'), 'mkdInlineURL'
+
+Given markdown;
+> [a](b)
+> http://foo.bar
+
+Execute (link in blockquote):
+ AssertEqual SyntaxOf('a'), 'mkdLink'
+ AssertEqual SyntaxOf('foo'), 'mkdInlineURL'
+
+# Code Blocks
+
+Given markdown;
+~~~
+code
+~~~
+
+Execute (code blocks can be fenced with tildes):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+~~~~
+code
+~~~~~
+
+Execute (code blocks can be fenced with tildes longer than 3):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+````
+code
+`````
+
+Execute (code blocks can be fenced with backticks longer than 3):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+~~~ruby
+code
+~~~
+
+Execute (code blocks can have a language specifier):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+```c++
+code
+```
+
+text
+
+Execute (code blocks can be fenced with backticks and a language specifier):
+ AssertEqual SyntaxOf('code'), 'mkdCode'
+ AssertNotEqual SyntaxOf('text'), 'mkdCode'
+
+# Indent Code Blocks
+
+Given markdown;
+a
+
+ b
+ c
+
+Execute (indent code blocks):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+ AssertEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+# a
+
+b
+
+ c
+
+Execute (indent code blocks after header):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+ AssertNotEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+- a
+
+ b
+
+ c
+
+Execute (indent code blocks after list):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+ AssertNotEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+ a
+ b
+
+Execute (indent code block at beginning of file):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+ AssertEqual SyntaxOf('b'), 'mkdCode'
+
+Given markdown;
+```c++
+#include <iostream>
+code
+```
+
+```ruby
+def a
+end
+```
+
+Execute (fenced code block syntax with a language specifier):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('include'), 'cInclude'
+ AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
+ AssertEqual SyntaxOf('def'), 'rubyDefine'
+
+Given markdown;
+``` c++
+#include <iostream>
+code
+```
+
+``` vim
+let g:a = 1
+```
+
+``` ruby
+def a
+end
+```
+
+```
+ruby
+class B
+end
+```
+
+Execute (fenced code block syntax with a language specifier after whitespace):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('include'), 'cInclude'
+ AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
+ AssertEqual SyntaxOf('g:a'), 'vimVar'
+ AssertEqual SyntaxOf('def'), 'rubyDefine'
+ AssertNotEqual SyntaxOf('class'), 'rubyClass'
+
+Given markdown;
+```vim
+let g:a = 1
+```
+
+```viml
+let g:b = 1
+```
+
+Execute (fenced code block syntax with alias language specifier):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('g:a'), 'vimVar'
+ AssertEqual SyntaxOf('g:b'), 'vimVar'
+
+Given markdown;
+```csharp
+var s = "foo";
+```
+
+Execute (fenced code block languages setting):
+ let g:vim_markdown_fenced_languages = ['csharp=cs']
+ source ../ftplugin/markdown.vim
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('foo'), 'csString'
+ unlet g:vim_markdown_fenced_languages
+
+Given markdown;
+```vim
+let g:a = 1
+```
+
+Execute (fenced code block includes language syntax with reopening same buffer):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ split
+ quit
+ edit
+ set filetype=markdown
+ execute "normal! i```vim\<cr>let g:a = 1\<cr>```"
+ call b:func(1)
+ AssertEqual SyntaxOf('g:a'), 'vimVar'
+
+Given markdown;
+```a+b-
+code
+```
+
+Execute (fenced code block syntax with an unknown language specifier):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ 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'
+
+Given markdown;
+``` {style=""}
+a
+```
+
+Execute (fenced code block with extended info strings):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+
+# Code Blocks in pre and code tag
+
+Given markdown;
+<pre>
+a
+</pre>
+
+Execute (code block in pre tag):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+
+Given markdown;
+<code>
+a
+</code>
+
+Execute (code block in code tag):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+
+Given markdown;
+\<pre\>
+a
+\</pre\>
+
+Execute (not code block in escaped pre tag):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+
+Given markdown;
+\<code\>
+a
+\</code\>
+
+Execute (not code block in escaped code tag):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+