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'
447 Execute (fenced code block syntax with a language specifier after whitespace):
448 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
450 AssertEqual SyntaxOf('include'), 'cInclude'
451 AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
452 AssertEqual SyntaxOf('g:a'), 'vimVar'
453 AssertEqual SyntaxOf('def'), 'rubyDefine'
454 AssertNotEqual SyntaxOf('class'), 'rubyClass'
465 Execute (fenced code block syntax with alias language specifier):
466 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
468 AssertEqual SyntaxOf('g:a'), 'vimVar'
469 AssertEqual SyntaxOf('g:b'), 'vimVar'
476 Execute (fenced code block languages setting):
477 let g:vim_markdown_fenced_languages = ['csharp=cs']
478 source ../ftplugin/markdown.vim
479 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
481 AssertEqual SyntaxOf('foo'), 'csString'
482 unlet g:vim_markdown_fenced_languages
489 Execute (fenced code block includes language syntax with reopening same buffer):
490 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
495 set filetype=markdown
496 execute "normal! i```vim\<cr>let g:a = 1\<cr>```"
498 AssertEqual SyntaxOf('g:a'), 'vimVar'
505 Execute (fenced code block syntax with an unknown language specifier):
506 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
508 AssertEqual SyntaxOf('code'), 'mkdSnippetA_B_'
517 Execute (first = or - in fenced code block is not setex headers):
518 AssertEqual SyntaxOf('='), 'mkdCode'
519 AssertEqual SyntaxOf('-'), 'mkdCode'
526 Execute (fenced code block with extended info strings):
527 AssertEqual SyntaxOf('a'), 'mkdCode'
529 # Code Blocks in pre and code tag
536 Execute (code block in pre tag):
537 AssertEqual SyntaxOf('a'), 'mkdCode'
544 Execute (code block in code tag):
545 AssertEqual SyntaxOf('a'), 'mkdCode'
552 Execute (not code block in escaped pre tag):
553 AssertNotEqual SyntaxOf('a'), 'mkdCode'
560 Execute (not code block in escaped code tag):
561 AssertNotEqual SyntaxOf('a'), 'mkdCode'
572 AssertNotEqual SyntaxOf('x'), 'mkdMath'
573 AssertNotEqual SyntaxOf('y'), 'mkdMath'
574 let g:vim_markdown_math=1
576 AssertNotEqual SyntaxOf('a'), 'mkdMath'
577 AssertNotEqual SyntaxOf('b'), 'mkdMath'
578 AssertNotEqual SyntaxOf('c'), 'mkdMath'
579 AssertNotEqual SyntaxOf('d'), 'mkdMath'
580 AssertNotEqual SyntaxOf('e'), 'mkdMath'
581 AssertNotEqual SyntaxOf('f'), 'mkdMath'
582 AssertEqual SyntaxOf('x'), 'mkdMath'
583 AssertEqual SyntaxOf('y'), 'mkdMath'
584 let g:vim_markdown_math=0
586 AssertNotEqual SyntaxOf('x'), 'mkdMath'
587 AssertNotEqual SyntaxOf('y'), 'mkdMath'
598 Execute (multiline math):
599 let g:vim_markdown_math=1
601 AssertNotEqual SyntaxOf('a'), 'mkdMath'
602 AssertEqual SyntaxOf('b'), 'mkdMath'
603 AssertNotEqual SyntaxOf('c'), 'mkdMath'
609 Execute (math tex highlighting):
610 let g:vim_markdown_math=0
612 AssertNotEqual SyntaxOf('sqrt'), 'texStatement'
613 AssertNotEqual SyntaxOf('frac'), 'texStatement'
614 let g:vim_markdown_math=1
616 AssertEqual SyntaxOf('sqrt'), 'texStatement'
617 AssertEqual SyntaxOf('frac'), 'texStatement'
626 Execute (YAML frontmatter is controlled by the option):
627 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
628 let g:vim_markdown_frontmatter=1
630 AssertEqual SyntaxOf('a')[0:3], 'yaml'
631 let g:vim_markdown_frontmatter=0
633 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
641 Execute (YAML frontmatter only works if it's the first thing in the file):
642 let g:vim_markdown_frontmatter=1
644 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
653 Execute (rules are not mistaken by YAML frontmatter delimiters):
654 let g:vim_markdown_frontmatter=1
656 AssertEqual SyntaxAt(5, 1), 'mkdRule'
657 unlet g:vim_markdown_frontmatter
666 Execute (TOML frontmatter is controlled by the option):
668 AssertNotEqual SyntaxOf('b'), 'tomlString'
669 let g:vim_markdown_toml_frontmatter=1
671 AssertEqual SyntaxOf('b'), 'tomlString'
672 let g:vim_markdown_toml_frontmatter=0
674 AssertNotEqual SyntaxOf('b'), 'tomlString'
682 Execute (TOML frontmatter only works if it's the first thing in the file):
683 let g:vim_markdown_toml_frontmatter=1
685 AssertNotEqual SyntaxOf('b'), 'tomlString'
686 unlet g:vim_markdown_toml_frontmatter
695 Execute (JSON frontmatter is controlled by the option):
697 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
698 let g:vim_markdown_json_frontmatter=1
700 AssertEqual SyntaxOf('a'), 'jsonKeyword'
701 let g:vim_markdown_json_frontmatter=0
703 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
711 Execute (JSON frontmatter only works if it's the first thing in the file):
712 let g:vim_markdown_json_frontmatter=1
714 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
715 unlet g:vim_markdown_json_frontmatter
726 Execute (header title starts with #):
727 AssertEqual SyntaxOf('a'), 'htmlH1'
728 AssertEqual SyntaxOf('b'), 'htmlH2'
743 ## h2 trailing hash ##
749 ### h3 trailing hash ###
757 Execute (atx headers):
758 AssertEqual SyntaxOf('# h1 space'), 'htmlH1'
759 AssertEqual SyntaxOf('#h1 nospace'), 'htmlH1'
760 AssertEqual SyntaxOf('# h1 2 spaces'), 'htmlH1'
761 AssertEqual SyntaxOf('# h1 trailing hash #'), 'htmlH1'
762 AssertEqual SyntaxOf('## h2 space'), 'htmlH2'
763 AssertEqual SyntaxOf('##h2 nospace'), 'htmlH2'
764 AssertEqual SyntaxOf('## h2 trailing hash ##'), 'htmlH2'
765 AssertEqual SyntaxOf('### h3 space'), 'htmlH3'
766 AssertEqual SyntaxOf('###h3 nospace'), 'htmlH3'
767 AssertEqual SyntaxOf('### h3 trailing hash ###'), 'htmlH3'
768 AssertEqual SyntaxOf('#### h4'), 'htmlH4'
769 AssertEqual SyntaxOf('##### h5'), 'htmlH5'
770 AssertEqual SyntaxOf('###### h6'), 'htmlH6'
779 Execute (atx headers relative positions):
780 AssertEqual SyntaxOf('# h1 before h2'), 'htmlH1'
781 AssertEqual SyntaxOf('## h2 between h1s'), 'htmlH2'
782 AssertEqual SyntaxOf('# h1 after h2'), 'htmlH1'
791 setex h1 single punctuation
794 setex h1 punctuation longer than header
795 ================================
797 Execute (setex headers):
798 AssertEqual SyntaxOf('setex h1'), 'htmlH1'
799 AssertEqual SyntaxOf('^========$'), 'htmlH1'
800 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
801 AssertEqual SyntaxOf('--------'), 'htmlH2'
802 AssertEqual SyntaxOf('setex h1 single punctuation'), 'htmlH1'
803 AssertEqual SyntaxOf('^=$'), 'htmlH1'
804 AssertEqual SyntaxOf('setex h1 punctuation longer than header'), 'htmlH1'
805 AssertEqual SyntaxOf('^================================$'), 'htmlH1'
811 Execute (prevent list vs Setex confusion):
812 AssertNotEqual SyntaxOf('- not Setex'), 'htmlH2'
813 AssertNotEqual SyntaxOf('- becuase list'), 'htmlH2'
830 Execute (mixed atx and setex headers):
831 AssertEqual SyntaxOf('setex h1 before atx'), 'htmlH1'
832 AssertEqual SyntaxOf('==================='), 'htmlH1'
833 AssertEqual SyntaxOf('## atx h2'), 'htmlH2'
834 AssertEqual SyntaxOf('### atx h3'), 'htmlH3'
835 AssertEqual SyntaxOf('# atx h1'), 'htmlH1'
836 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
837 AssertEqual SyntaxOf('------------------'), 'htmlH2'
845 Execute (& and > are not marked as htmlError in lists):
846 AssertEqual SyntaxOf('-'), 'mkdListItem'
847 AssertEqual SyntaxOf('1.'), 'mkdListItem'
848 AssertNotEqual SyntaxOf('&'), 'htmlError'
849 AssertNotEqual SyntaxOf('>'), 'htmlError'
855 Execute (list after line break):
856 AssertEqual SyntaxOf('1'), 'mkdListItem'
857 AssertEqual SyntaxOf('2'), 'mkdListItem'
868 Execute (HTML tag in text):
869 AssertEqual SyntaxOf('p'), 'htmlTagName'
870 AssertEqual SyntaxOf('<p>'), 'htmlTag'
871 AssertEqual SyntaxOf('</p>'), 'htmlEndTag'
872 AssertEqual SyntaxOf('span'), 'htmlTagName'
873 AssertEqual SyntaxOf('<span>'), 'htmlTag'
874 AssertEqual SyntaxOf('</span>'), 'htmlEndTag'