All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
5 AssertNotEqual SyntaxOf('a'), 'htmlBold'
6 AssertEqual SyntaxOf('b'), 'htmlBold'
7 AssertNotEqual SyntaxOf('c'), 'htmlBold'
13 AssertNotEqual SyntaxOf('a'), 'htmlBold'
14 AssertEqual SyntaxOf('b'), 'htmlBold'
15 AssertNotEqual SyntaxOf('c'), 'htmlBold'
21 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
22 AssertEqual SyntaxOf('b'), 'htmlItalic'
23 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
29 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
30 AssertEqual SyntaxOf('b'), 'htmlItalic'
31 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
36 Execute (italic text has underscores):
37 AssertEqual SyntaxOf('a'), 'htmlItalic'
38 AssertEqual SyntaxOf('b'), 'htmlItalic'
43 Execute (not italic with escaped asterisks):
44 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
45 AssertNotEqual SyntaxOf('b'), 'htmlItalic'
46 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
51 Execute (not italic with escaped underscores):
52 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
53 AssertNotEqual SyntaxOf('b'), 'htmlItalic'
54 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
59 Execute (italic with escaped underscores):
60 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
61 AssertEqual SyntaxOf('b'), 'htmlItalic'
62 AssertEqual SyntaxOf('c'), 'htmlItalic'
63 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
68 Execute (not italic underscores within text):
69 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
70 AssertNotEqual SyntaxOf('b'), 'htmlItalic'
71 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
76 Execute (italic with escaped asterisks):
77 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
78 AssertEqual SyntaxOf('b'), 'htmlItalic'
79 AssertEqual SyntaxOf('c'), 'htmlItalic'
80 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
85 Execute (bold with escaped underscores):
86 AssertNotEqual SyntaxOf('a'), 'htmlBold'
87 AssertEqual SyntaxOf('b'), 'htmlBold'
88 AssertEqual SyntaxOf('c'), 'htmlBold'
89 AssertNotEqual SyntaxOf('d'), 'htmlBold'
95 Execute (italic with underscores in multiple lines):
96 AssertEqual SyntaxOf('a'), 'htmlItalic'
97 AssertEqual SyntaxOf('b'), 'htmlItalic'
98 AssertEqual SyntaxOf('c'), 'htmlItalic'
99 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
105 Execute (bold with underscores in multiple lines):
106 AssertEqual SyntaxOf('a'), 'htmlBold'
107 AssertEqual SyntaxOf('b'), 'htmlBold'
108 AssertEqual SyntaxOf('c'), 'htmlBold'
109 AssertNotEqual SyntaxOf('d'), 'htmlBold'
115 Execute (bold italic with underscores in multiple lines):
116 AssertEqual SyntaxOf('a'), 'htmlBoldItalic'
117 AssertEqual SyntaxOf('b'), 'htmlBoldItalic'
118 AssertEqual SyntaxOf('c'), 'htmlBoldItalic'
119 AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
125 Execute (italic with asterisks in multiple lines):
126 AssertEqual SyntaxOf('a'), 'htmlItalic'
127 AssertEqual SyntaxOf('b'), 'htmlItalic'
128 AssertEqual SyntaxOf('c'), 'htmlItalic'
129 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
135 Execute (bold with asterisks in multiple lines):
136 AssertEqual SyntaxOf('a'), 'htmlBold'
137 AssertEqual SyntaxOf('b'), 'htmlBold'
138 AssertEqual SyntaxOf('c'), 'htmlBold'
139 AssertNotEqual SyntaxOf('d'), 'htmlBold'
145 Execute (bold italic with asterisks in multiple lines):
146 AssertEqual SyntaxOf('a'), 'htmlBoldItalic'
147 AssertEqual SyntaxOf('b'), 'htmlBoldItalic'
148 AssertEqual SyntaxOf('c'), 'htmlBoldItalic'
149 AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
154 Execute (not italic with an asterisk):
155 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
160 Execute (not bold with double underscores):
161 AssertNotEqual SyntaxOf('_'), 'htmlBold'
162 AssertNotEqual SyntaxOf('a'), 'htmlBold'
163 AssertNotEqual SyntaxOf('b'), 'htmlBold'
170 Execute (link with title):
171 AssertEqual SyntaxOf('a'), 'mkdLink'
172 AssertEqual SyntaxOf('b'), 'mkdURL'
178 Execute (link text with newline):
179 AssertEqual SyntaxOf('a'), 'mkdLink'
180 AssertEqual SyntaxOf('b'), 'mkdLink'
181 AssertEqual SyntaxOf('c'), 'mkdURL'
188 Execute (parenthesis not in link):
189 AssertNotEqual SyntaxOf('a'), 'mkdURL'
190 AssertNotEqual SyntaxOf('b'), 'mkdURL'
195 Execute (multiple links on a line):
196 AssertNotEqual SyntaxOf('c'), 'mkdLink'
197 AssertNotEqual SyntaxOf('c'), 'mkdURL'
202 Execute (space is not allowed between link text and parenthesis):
203 AssertNotEqual SyntaxOf('a'), 'mkdLink'
204 AssertNotEqual SyntaxOf('b'), 'mkdURL'
209 Execute (conceal link):
211 setlocal conceallevel=2
212 AssertEqual synconcealed(1, 1)[0], 1
213 AssertEqual synconcealed(1, 2)[0], 0
214 AssertEqual synconcealed(1, 3)[0], 1
215 AssertEqual synconcealed(1, 4)[0], 1
216 AssertEqual synconcealed(1, 4)[0], 1
217 AssertEqual synconcealed(1, 5)[0], 1
218 AssertEqual synconcealed(1, 6)[0], 1
219 setlocal conceallevel=0
222 Execute (disable conceal):
224 let g:vim_markdown_conceal=0
226 setlocal conceallevel=2
227 AssertEqual synconcealed(1, 1)[0], 0
228 AssertEqual synconcealed(1, 2)[0], 0
229 AssertEqual synconcealed(1, 3)[0], 0
230 AssertEqual synconcealed(1, 4)[0], 0
231 AssertEqual synconcealed(1, 4)[0], 0
232 AssertEqual synconcealed(1, 5)[0], 0
233 AssertEqual synconcealed(1, 6)[0], 0
235 let g:vim_markdown_conceal=1
237 AssertEqual synconcealed(1, 1)[0], 1
238 AssertEqual synconcealed(1, 2)[0], 0
239 AssertEqual synconcealed(1, 3)[0], 1
240 AssertEqual synconcealed(1, 4)[0], 1
241 AssertEqual synconcealed(1, 4)[0], 1
242 AssertEqual synconcealed(1, 5)[0], 1
243 AssertEqual synconcealed(1, 6)[0], 1
245 setlocal conceallevel=0
246 unlet g:vim_markdown_conceal
256 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
257 AssertEqual SyntaxOf('<'), 'mkdDelimiter'
258 AssertEqual SyntaxOf('b'), 'mkdInlineURL'
259 AssertEqual SyntaxOf('>'), 'mkdDelimiter'
260 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
265 Execute (autolink with domain starting with a number):
266 AssertEqual SyntaxOf('12monkeys'), 'mkdInlineURL'
271 Execute (autolink with scheme case is insensitive):
272 AssertEqual SyntaxOf('a'), 'mkdInlineURL'
277 Execute (autolink without scheme is not a link):
278 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
286 Execute (autolink with space is not a link):
287 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
288 AssertNotEqual SyntaxOf('b'), 'mkdInlineURL'
289 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
290 AssertNotEqual SyntaxOf('d'), 'mkdInlineURL'
291 AssertNotEqual SyntaxOf('e'), 'mkdInlineURL'
296 Execute (autolinks can be backslash escaped):
297 AssertNotEqual SyntaxOf('<'), 'mkdDelimiter'
302 Execute (autolink in parenthesis):
303 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
304 AssertEqual SyntaxOf('('), 'mkdDelimiter'
305 AssertEqual SyntaxOf('b'), 'mkdInlineURL'
306 AssertEqual SyntaxOf(')'), 'mkdDelimiter'
307 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
310 [![a](http://b)](http://c)
312 Execute (autolink in link text):
313 AssertEqual SyntaxOf('!'), 'mkdDelimiter'
314 AssertEqual SyntaxOf('a'), 'mkdLink'
315 AssertEqual SyntaxOf('b'), 'mkdURL'
316 AssertEqual SyntaxOf('c'), 'mkdURL'
325 Execute (code blocks can be fenced with tildes):
326 AssertEqual SyntaxOf('c'), 'mkdCode'
333 Execute (code blocks can be fenced with tildes longer than 3):
334 AssertEqual SyntaxOf('c'), 'mkdCode'
341 Execute (code blocks can be fenced with backticks longer than 3):
342 AssertEqual SyntaxOf('c'), 'mkdCode'
349 Execute (code blocks can have a language specifier):
350 AssertEqual SyntaxOf('c'), 'mkdCode'
359 Execute (code blocks can be fenced with backticks and a language specifier):
360 AssertEqual SyntaxOf('code'), 'mkdCode'
361 AssertNotEqual SyntaxOf('text'), 'mkdCode'
371 Execute (indent code blocks):
372 AssertNotEqual SyntaxOf('a'), 'mkdCode'
373 AssertEqual SyntaxOf('b'), 'mkdCode'
374 AssertEqual SyntaxOf('c'), 'mkdCode'
383 Execute (indent code blocks after header):
384 AssertNotEqual SyntaxOf('a'), 'mkdCode'
385 AssertNotEqual SyntaxOf('b'), 'mkdCode'
386 AssertEqual SyntaxOf('c'), 'mkdCode'
395 Execute (indent code blocks after list):
396 AssertNotEqual SyntaxOf('a'), 'mkdCode'
397 AssertNotEqual SyntaxOf('b'), 'mkdCode'
398 AssertEqual SyntaxOf('c'), 'mkdCode'
404 Execute (indent code block at beginning of file):
405 AssertEqual SyntaxOf('a'), 'mkdCode'
406 AssertEqual SyntaxOf('b'), 'mkdCode'
419 Execute (fenced code block syntax with a language specifier):
420 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
422 AssertEqual SyntaxOf('include'), 'cInclude'
423 AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
424 AssertEqual SyntaxOf('def'), 'rubyDefine'
435 Execute (fenced code block syntax with alias language specifier):
436 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
438 AssertEqual SyntaxOf('g:a'), 'vimVar'
439 AssertEqual SyntaxOf('g:b'), 'vimVar'
446 Execute (fenced code block languages setting):
447 let g:vim_markdown_fenced_languages = ['csharp=cs']
448 source ../ftplugin/markdown.vim
449 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
451 AssertEqual SyntaxOf('foo'), 'csString'
452 unlet g:vim_markdown_fenced_languages
459 Execute (fenced code block includes language syntax with reopening same buffer):
460 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
465 set filetype=markdown
466 execute "normal! i```vim\<cr>let g:a = 1\<cr>```"
468 AssertEqual SyntaxOf('g:a'), 'vimVar'
475 Execute (fenced code block syntax with an unknown language specifier):
476 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
478 AssertEqual SyntaxOf('code'), 'mkdSnippetA_B_'
487 Execute (first = or - in fenced code block is not setex headers):
488 AssertEqual SyntaxOf('='), 'mkdCode'
489 AssertEqual SyntaxOf('-'), 'mkdCode'
496 Execute (fenced code block with extended info strings):
497 AssertEqual SyntaxOf('a'), 'mkdCode'
499 # Code Blocks in pre and code tag
506 Execute (code block in pre tag):
507 AssertEqual SyntaxOf('a'), 'mkdCode'
514 Execute (code block in code tag):
515 AssertEqual SyntaxOf('a'), 'mkdCode'
522 Execute (not code block in escaped pre tag):
523 AssertNotEqual SyntaxOf('a'), 'mkdCode'
530 Execute (not code block in escaped code tag):
531 AssertNotEqual SyntaxOf('a'), 'mkdCode'
542 AssertNotEqual SyntaxOf('x'), 'mkdMath'
543 AssertNotEqual SyntaxOf('y'), 'mkdMath'
544 let g:vim_markdown_math=1
546 AssertNotEqual SyntaxOf('a'), 'mkdMath'
547 AssertNotEqual SyntaxOf('b'), 'mkdMath'
548 AssertNotEqual SyntaxOf('c'), 'mkdMath'
549 AssertNotEqual SyntaxOf('d'), 'mkdMath'
550 AssertNotEqual SyntaxOf('e'), 'mkdMath'
551 AssertNotEqual SyntaxOf('f'), 'mkdMath'
552 AssertEqual SyntaxOf('x'), 'mkdMath'
553 AssertEqual SyntaxOf('y'), 'mkdMath'
554 let g:vim_markdown_math=0
556 AssertNotEqual SyntaxOf('x'), 'mkdMath'
557 AssertNotEqual SyntaxOf('y'), 'mkdMath'
568 Execute (multiline math):
569 let g:vim_markdown_math=1
571 AssertNotEqual SyntaxOf('a'), 'mkdMath'
572 AssertEqual SyntaxOf('b'), 'mkdMath'
573 AssertNotEqual SyntaxOf('c'), 'mkdMath'
579 Execute (math tex highlighting):
580 let g:vim_markdown_math=0
582 AssertNotEqual SyntaxOf('sqrt'), 'texStatement'
583 AssertNotEqual SyntaxOf('frac'), 'texStatement'
584 let g:vim_markdown_math=1
586 AssertEqual SyntaxOf('sqrt'), 'texStatement'
587 AssertEqual SyntaxOf('frac'), 'texStatement'
596 Execute (YAML frontmatter is controlled by the option):
597 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
598 let g:vim_markdown_frontmatter=1
600 AssertEqual SyntaxOf('a')[0:3], 'yaml'
601 let g:vim_markdown_frontmatter=0
603 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
611 Execute (YAML frontmatter only works if it's the first thing in the file):
612 let g:vim_markdown_frontmatter=1
614 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
623 Execute (rules are not mistaken by YAML frontmatter delimiters):
624 let g:vim_markdown_frontmatter=1
626 AssertEqual SyntaxAt(5, 1), 'mkdRule'
627 unlet g:vim_markdown_frontmatter
636 Execute (TOML frontmatter is controlled by the option):
638 AssertNotEqual SyntaxOf('b'), 'tomlString'
639 let g:vim_markdown_toml_frontmatter=1
641 AssertEqual SyntaxOf('b'), 'tomlString'
642 let g:vim_markdown_toml_frontmatter=0
644 AssertNotEqual SyntaxOf('b'), 'tomlString'
652 Execute (TOML frontmatter only works if it's the first thing in the file):
653 let g:vim_markdown_toml_frontmatter=1
655 AssertNotEqual SyntaxOf('b'), 'tomlString'
656 unlet g:vim_markdown_toml_frontmatter
665 Execute (JSON frontmatter is controlled by the option):
667 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
668 let g:vim_markdown_json_frontmatter=1
670 AssertEqual SyntaxOf('a'), 'jsonKeyword'
671 let g:vim_markdown_json_frontmatter=0
673 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
681 Execute (JSON frontmatter only works if it's the first thing in the file):
682 let g:vim_markdown_json_frontmatter=1
684 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
685 unlet g:vim_markdown_json_frontmatter
696 Execute (header title starts with #):
697 AssertEqual SyntaxOf('a'), 'htmlH1'
698 AssertEqual SyntaxOf('b'), 'htmlH2'
713 ## h2 trailing hash ##
719 ### h3 trailing hash ###
727 Execute (atx headers):
728 AssertEqual SyntaxOf('# h1 space'), 'htmlH1'
729 AssertEqual SyntaxOf('#h1 nospace'), 'htmlH1'
730 AssertEqual SyntaxOf('# h1 2 spaces'), 'htmlH1'
731 AssertEqual SyntaxOf('# h1 trailing hash #'), 'htmlH1'
732 AssertEqual SyntaxOf('## h2 space'), 'htmlH2'
733 AssertEqual SyntaxOf('##h2 nospace'), 'htmlH2'
734 AssertEqual SyntaxOf('## h2 trailing hash ##'), 'htmlH2'
735 AssertEqual SyntaxOf('### h3 space'), 'htmlH3'
736 AssertEqual SyntaxOf('###h3 nospace'), 'htmlH3'
737 AssertEqual SyntaxOf('### h3 trailing hash ###'), 'htmlH3'
738 AssertEqual SyntaxOf('#### h4'), 'htmlH4'
739 AssertEqual SyntaxOf('##### h5'), 'htmlH5'
740 AssertEqual SyntaxOf('###### h6'), 'htmlH6'
749 Execute (atx headers relative positions):
750 AssertEqual SyntaxOf('# h1 before h2'), 'htmlH1'
751 AssertEqual SyntaxOf('## h2 between h1s'), 'htmlH2'
752 AssertEqual SyntaxOf('# h1 after h2'), 'htmlH1'
761 setex h1 single punctuation
764 setex h1 punctuation longer than header
765 ================================
767 Execute (setex headers):
768 AssertEqual SyntaxOf('setex h1'), 'htmlH1'
769 AssertEqual SyntaxOf('^========$'), 'htmlH1'
770 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
771 AssertEqual SyntaxOf('--------'), 'htmlH2'
772 AssertEqual SyntaxOf('setex h1 single punctuation'), 'htmlH1'
773 AssertEqual SyntaxOf('^=$'), 'htmlH1'
774 AssertEqual SyntaxOf('setex h1 punctuation longer than header'), 'htmlH1'
775 AssertEqual SyntaxOf('^================================$'), 'htmlH1'
781 Execute (prevent list vs Setex confusion):
782 AssertNotEqual SyntaxOf('- not Setex'), 'htmlH2'
783 AssertNotEqual SyntaxOf('- becuase list'), 'htmlH2'
800 Execute (mixed atx and setex headers):
801 AssertEqual SyntaxOf('setex h1 before atx'), 'htmlH1'
802 AssertEqual SyntaxOf('==================='), 'htmlH1'
803 AssertEqual SyntaxOf('## atx h2'), 'htmlH2'
804 AssertEqual SyntaxOf('### atx h3'), 'htmlH3'
805 AssertEqual SyntaxOf('# atx h1'), 'htmlH1'
806 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
807 AssertEqual SyntaxOf('------------------'), 'htmlH2'
815 Execute (& and > are not marked as htmlError in lists):
816 AssertEqual SyntaxOf('-'), 'mkdListItem'
817 AssertEqual SyntaxOf('1.'), 'mkdListItem'
818 AssertNotEqual SyntaxOf('&'), 'htmlError'
819 AssertNotEqual SyntaxOf('>'), 'htmlError'
825 Execute (list after line break):
826 AssertEqual SyntaxOf('1'), 'mkdListItem'
827 AssertEqual SyntaxOf('2'), 'mkdListItem'
838 Execute (HTML tag in text):
839 AssertEqual SyntaxOf('p'), 'htmlTagName'
840 AssertEqual SyntaxOf('<p>'), 'htmlTag'
841 AssertEqual SyntaxOf('</p>'), 'htmlEndTag'
842 AssertEqual SyntaxOf('span'), 'htmlTagName'
843 AssertEqual SyntaxOf('<span>'), 'htmlTag'
844 AssertEqual SyntaxOf('</span>'), 'htmlEndTag'