AssertNotEqual SyntaxOf('a'), 'htmlBold'
AssertNotEqual SyntaxOf('b'), 'htmlBold'
+Given markdown;
+_a_
+
+Execute (conceal italic):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+*a*
+
+Execute (conceal italic):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+__a__
+
+Execute (conceal bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+**a**
+
+Execute (conceal bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+___a___
+
+Execute (conceal italic bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+ AssertEqual synconcealed(1, 6)[0], 0
+ AssertEqual synconcealed(1, 7)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+***a***
+
+Execute (conceal italic bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+ AssertEqual synconcealed(1, 6)[0], 0
+ AssertEqual synconcealed(1, 7)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
# Links
Given markdown;
AssertEqual SyntaxOf('b'), 'mkdLink'
AssertEqual SyntaxOf('c'), 'mkdURL'
+Given markdown;
+[a] b [c](d)
+
+Execute (link text with bracket sections):
+ AssertNotEqual SyntaxOf('a'), 'mkdLink'
+ AssertNotEqual SyntaxOf('b'), 'mkdLink'
+ AssertEqual SyntaxOf('c'), 'mkdLink'
+ AssertEqual SyntaxOf('d'), 'mkdURL'
+
+Given markdown;
+[^a]: b
+
+Execute (footnote is not link):
+ AssertNotEqual SyntaxOf('a'), 'mkdLinkDef'
+
Given markdown;
(a)
AssertEqual SyntaxOf('a'), 'mkdLink'
AssertEqual SyntaxOf('foo'), 'mkdInlineURL'
+Given markdown;
+[https://domain.tld](https://domain.com) not_a_link
+
+Execute (link with url title):
+ AssertEqual SyntaxOf('https://domain.tld'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('https://domain.com'), 'mkdInlineURL'
+ AssertNotEqual SyntaxOf('not_a_link'), 'mkdInlineURL'
+
# Code Blocks
Given markdown;
###### h6
Execute (atx headers):
- AssertEqual SyntaxOf('# h1 space'), 'htmlH1'
- AssertEqual SyntaxOf('#h1 nospace'), 'htmlH1'
- AssertEqual SyntaxOf('# h1 2 spaces'), 'htmlH1'
- AssertEqual SyntaxOf('# h1 trailing hash #'), 'htmlH1'
- AssertEqual SyntaxOf('## h2 space'), 'htmlH2'
- AssertEqual SyntaxOf('##h2 nospace'), 'htmlH2'
- AssertEqual SyntaxOf('## h2 trailing hash ##'), 'htmlH2'
- AssertEqual SyntaxOf('### h3 space'), 'htmlH3'
- AssertEqual SyntaxOf('###h3 nospace'), 'htmlH3'
- AssertEqual SyntaxOf('### h3 trailing hash ###'), 'htmlH3'
- AssertEqual SyntaxOf('#### h4'), 'htmlH4'
- AssertEqual SyntaxOf('##### h5'), 'htmlH5'
- AssertEqual SyntaxOf('###### h6'), 'htmlH6'
+ AssertEqual SyntaxOf(' h1 space'), 'htmlH1'
+ AssertEqual SyntaxOf('h1 nospace'), 'htmlH1'
+ AssertEqual SyntaxOf(' h1 2 spaces'), 'htmlH1'
+ AssertEqual SyntaxOf(' h1 trailing hash '), 'htmlH1'
+ AssertEqual SyntaxOf(' h2 space'), 'htmlH2'
+ AssertEqual SyntaxOf('h2 nospace'), 'htmlH2'
+ AssertEqual SyntaxOf(' h2 trailing hash '), 'htmlH2'
+ AssertEqual SyntaxOf(' h3 space'), 'htmlH3'
+ AssertEqual SyntaxOf('h3 nospace'), 'htmlH3'
+ AssertEqual SyntaxOf(' h3 trailing hash '), 'htmlH3'
+ AssertEqual SyntaxOf(' h4'), 'htmlH4'
+ AssertEqual SyntaxOf(' h5'), 'htmlH5'
+ AssertEqual SyntaxOf(' h6'), 'htmlH6'
Given markdown;
# h1 before h2
# h1 after h2
Execute (atx headers relative positions):
- AssertEqual SyntaxOf('# h1 before h2'), 'htmlH1'
- AssertEqual SyntaxOf('## h2 between h1s'), 'htmlH2'
- AssertEqual SyntaxOf('# h1 after h2'), 'htmlH1'
+ AssertEqual SyntaxOf(' h1 before h2'), 'htmlH1'
+ AssertEqual SyntaxOf(' h2 between h1s'), 'htmlH2'
+ AssertEqual SyntaxOf(' h1 after h2'), 'htmlH1'
Given markdown;
setex h1
Execute (mixed atx and setex headers):
AssertEqual SyntaxOf('setex h1 before atx'), 'htmlH1'
AssertEqual SyntaxOf('==================='), 'htmlH1'
- AssertEqual SyntaxOf('## atx h2'), 'htmlH2'
- AssertEqual SyntaxOf('### atx h3'), 'htmlH3'
- AssertEqual SyntaxOf('# atx h1'), 'htmlH1'
+ AssertEqual SyntaxOf(' atx h2'), 'htmlH2'
+ AssertEqual SyntaxOf(' atx h3'), 'htmlH3'
+ AssertEqual SyntaxOf(' atx h1'), 'htmlH1'
AssertEqual SyntaxOf('setex h2'), 'htmlH2'
AssertEqual SyntaxOf('------------------'), 'htmlH2'