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'
162 Execute (link with title):
163 AssertEqual SyntaxOf('a'), 'mkdLink'
164 AssertEqual SyntaxOf('b'), 'mkdURL'
170 Execute (link text with newline):
171 AssertEqual SyntaxOf('a'), 'mkdLink'
172 AssertEqual SyntaxOf('b'), 'mkdLink'
173 AssertEqual SyntaxOf('c'), 'mkdURL'
180 Execute (parenthesis not in link):
181 AssertNotEqual SyntaxOf('a'), 'mkdURL'
182 AssertNotEqual SyntaxOf('b'), 'mkdURL'
187 Execute (multiple links on a line):
188 AssertNotEqual SyntaxOf('c'), 'mkdLink'
189 AssertNotEqual SyntaxOf('c'), 'mkdURL'
194 Execute (space is not allowed between link text and parenthesis):
195 AssertNotEqual SyntaxOf('a'), 'mkdLink'
196 AssertNotEqual SyntaxOf('b'), 'mkdURL'
201 Execute (conceal link):
203 setlocal conceallevel=2
204 AssertEqual synconcealed(1, 1)[0], 1
205 AssertEqual synconcealed(1, 2)[0], 0
206 AssertEqual synconcealed(1, 3)[0], 1
207 AssertEqual synconcealed(1, 4)[0], 1
208 AssertEqual synconcealed(1, 4)[0], 1
209 AssertEqual synconcealed(1, 5)[0], 1
210 AssertEqual synconcealed(1, 6)[0], 1
211 setlocal conceallevel=0
214 Execute (disable conceal):
216 let g:vim_markdown_conceal=0
218 setlocal conceallevel=2
219 AssertEqual synconcealed(1, 1)[0], 0
220 AssertEqual synconcealed(1, 2)[0], 0
221 AssertEqual synconcealed(1, 3)[0], 0
222 AssertEqual synconcealed(1, 4)[0], 0
223 AssertEqual synconcealed(1, 4)[0], 0
224 AssertEqual synconcealed(1, 5)[0], 0
225 AssertEqual synconcealed(1, 6)[0], 0
227 let g:vim_markdown_conceal=1
229 AssertEqual synconcealed(1, 1)[0], 1
230 AssertEqual synconcealed(1, 2)[0], 0
231 AssertEqual synconcealed(1, 3)[0], 1
232 AssertEqual synconcealed(1, 4)[0], 1
233 AssertEqual synconcealed(1, 4)[0], 1
234 AssertEqual synconcealed(1, 5)[0], 1
235 AssertEqual synconcealed(1, 6)[0], 1
237 setlocal conceallevel=0
238 unlet g:vim_markdown_conceal
248 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
249 AssertEqual SyntaxOf('<'), 'mkdDelimiter'
250 AssertEqual SyntaxOf('b'), 'mkdInlineURL'
251 AssertEqual SyntaxOf('>'), 'mkdDelimiter'
252 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
257 Execute (autolink with domain starting with a number):
258 AssertEqual SyntaxOf('12monkeys'), 'mkdInlineURL'
263 Execute (autolink with scheme case is insensitive):
264 AssertEqual SyntaxOf('a'), 'mkdInlineURL'
269 Execute (autolink without scheme is not a link):
270 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
278 Execute (autolink with space is not a link):
279 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
280 AssertNotEqual SyntaxOf('b'), 'mkdInlineURL'
281 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
282 AssertNotEqual SyntaxOf('d'), 'mkdInlineURL'
283 AssertNotEqual SyntaxOf('e'), 'mkdInlineURL'
288 Execute (autolinks can be backslash escaped):
289 AssertNotEqual SyntaxOf('<'), 'mkdDelimiter'
294 Execute (autolink in parenthesis):
295 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
296 AssertEqual SyntaxOf('('), 'mkdDelimiter'
297 AssertEqual SyntaxOf('b'), 'mkdInlineURL'
298 AssertEqual SyntaxOf(')'), 'mkdDelimiter'
299 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
302 [![a](http://b)](http://c)
304 Execute (autolink in link text):
305 AssertEqual SyntaxOf('!'), 'mkdDelimiter'
306 AssertEqual SyntaxOf('a'), 'mkdLink'
307 AssertEqual SyntaxOf('b'), 'mkdURL'
308 AssertEqual SyntaxOf('c'), 'mkdURL'
317 Execute (code blocks can be fenced with tildes):
318 AssertEqual SyntaxOf('c'), 'mkdCode'
325 Execute (code blocks can be fenced with tildes longer than 3):
326 AssertEqual SyntaxOf('c'), 'mkdCode'
333 Execute (code blocks can be fenced with backticks longer than 3):
334 AssertEqual SyntaxOf('c'), 'mkdCode'
341 Execute (code blocks can have a language specifier):
342 AssertEqual SyntaxOf('c'), 'mkdCode'
351 Execute (code blocks can be fenced with backticks and a language specifier):
352 AssertEqual SyntaxOf('code'), 'mkdCode'
353 AssertNotEqual SyntaxOf('text'), 'mkdCode'
363 Execute (indent code blocks):
364 AssertNotEqual SyntaxOf('a'), 'mkdCode'
365 AssertEqual SyntaxOf('b'), 'mkdCode'
366 AssertEqual SyntaxOf('c'), 'mkdCode'
375 Execute (indent code blocks after header):
376 AssertNotEqual SyntaxOf('a'), 'mkdCode'
377 AssertNotEqual SyntaxOf('b'), 'mkdCode'
378 AssertEqual SyntaxOf('c'), 'mkdCode'
387 Execute (indent code blocks after list):
388 AssertNotEqual SyntaxOf('a'), 'mkdCode'
389 AssertNotEqual SyntaxOf('b'), 'mkdCode'
390 AssertEqual SyntaxOf('c'), 'mkdCode'
396 Execute (indent code block at beginning of file):
397 AssertEqual SyntaxOf('a'), 'mkdCode'
398 AssertEqual SyntaxOf('b'), 'mkdCode'
411 Execute (fenced code block syntax with a language specifier):
412 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
414 AssertEqual SyntaxOf('include'), 'cInclude'
415 AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
416 AssertEqual SyntaxOf('def'), 'rubyDefine'
427 Execute (fenced code block syntax with alias language specifier):
428 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
430 AssertEqual SyntaxOf('g:a'), 'vimVar'
431 AssertEqual SyntaxOf('g:b'), 'vimVar'
438 Execute (fenced code block languages setting):
439 let g:vim_markdown_fenced_languages = ['csharp=cs']
440 source ../ftplugin/markdown.vim
441 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
443 AssertEqual SyntaxOf('foo'), 'csString'
444 unlet g:vim_markdown_fenced_languages
451 Execute (fenced code block includes language syntax with reopening same buffer):
452 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
457 set filetype=markdown
458 execute "normal! i```vim\<cr>let g:a = 1\<cr>```"
460 AssertEqual SyntaxOf('g:a'), 'vimVar'
467 Execute (fenced code block syntax with an unknown language specifier):
468 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
470 AssertEqual SyntaxOf('code'), 'mkdSnippetA_B_'
479 Execute (first = or - in fenced code block is not setex headers):
480 AssertEqual SyntaxOf('='), 'mkdCode'
481 AssertEqual SyntaxOf('-'), 'mkdCode'
488 Execute (fenced code block with extended info strings):
489 AssertEqual SyntaxOf('a'), 'mkdCode'
491 # Code Blocks in pre and code tag
498 Execute (code block in pre tag):
499 AssertEqual SyntaxOf('a'), 'mkdCode'
506 Execute (code block in code tag):
507 AssertEqual SyntaxOf('a'), 'mkdCode'
514 Execute (not code block in escaped pre tag):
515 AssertNotEqual SyntaxOf('a'), 'mkdCode'
522 Execute (not code block in escaped code tag):
523 AssertNotEqual SyntaxOf('a'), 'mkdCode'
534 AssertNotEqual SyntaxOf('x'), 'mkdMath'
535 AssertNotEqual SyntaxOf('y'), 'mkdMath'
536 let g:vim_markdown_math=1
538 AssertNotEqual SyntaxOf('a'), 'mkdMath'
539 AssertNotEqual SyntaxOf('b'), 'mkdMath'
540 AssertNotEqual SyntaxOf('c'), 'mkdMath'
541 AssertNotEqual SyntaxOf('d'), 'mkdMath'
542 AssertNotEqual SyntaxOf('e'), 'mkdMath'
543 AssertNotEqual SyntaxOf('f'), 'mkdMath'
544 AssertEqual SyntaxOf('x'), 'mkdMath'
545 AssertEqual SyntaxOf('y'), 'mkdMath'
546 let g:vim_markdown_math=0
548 AssertNotEqual SyntaxOf('x'), 'mkdMath'
549 AssertNotEqual SyntaxOf('y'), 'mkdMath'
560 Execute (multiline math):
561 let g:vim_markdown_math=1
563 AssertNotEqual SyntaxOf('a'), 'mkdMath'
564 AssertEqual SyntaxOf('b'), 'mkdMath'
565 AssertNotEqual SyntaxOf('c'), 'mkdMath'
571 Execute (math tex highlighting):
572 let g:vim_markdown_math=0
574 AssertNotEqual SyntaxOf('sqrt'), 'texStatement'
575 AssertNotEqual SyntaxOf('frac'), 'texStatement'
576 let g:vim_markdown_math=1
578 AssertEqual SyntaxOf('sqrt'), 'texStatement'
579 AssertEqual SyntaxOf('frac'), 'texStatement'
588 Execute (YAML frontmatter is controlled by the option):
589 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
590 let g:vim_markdown_frontmatter=1
592 AssertEqual SyntaxOf('a')[0:3], 'yaml'
593 let g:vim_markdown_frontmatter=0
595 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
603 Execute (YAML frontmatter only works if it's the first thing in the file):
604 let g:vim_markdown_frontmatter=1
606 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
615 Execute (rules are not mistaken by YAML frontmatter delimiters):
616 let g:vim_markdown_frontmatter=1
618 AssertEqual SyntaxAt(5, 1), 'mkdRule'
619 unlet g:vim_markdown_frontmatter
628 Execute (TOML frontmatter is controlled by the option):
630 AssertNotEqual SyntaxOf('b'), 'tomlString'
631 let g:vim_markdown_toml_frontmatter=1
633 AssertEqual SyntaxOf('b'), 'tomlString'
634 let g:vim_markdown_toml_frontmatter=0
636 AssertNotEqual SyntaxOf('b'), 'tomlString'
644 Execute (TOML frontmatter only works if it's the first thing in the file):
645 let g:vim_markdown_toml_frontmatter=1
647 AssertNotEqual SyntaxOf('b'), 'tomlString'
648 unlet g:vim_markdown_toml_frontmatter
657 Execute (JSON frontmatter is controlled by the option):
659 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
660 let g:vim_markdown_json_frontmatter=1
662 AssertEqual SyntaxOf('a'), 'jsonKeyword'
663 let g:vim_markdown_json_frontmatter=0
665 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
673 Execute (JSON frontmatter only works if it's the first thing in the file):
674 let g:vim_markdown_json_frontmatter=1
676 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
677 unlet g:vim_markdown_json_frontmatter
688 Execute (header title starts with #):
689 AssertEqual SyntaxOf('a'), 'htmlH1'
690 AssertEqual SyntaxOf('b'), 'htmlH2'
705 ## h2 trailing hash ##
711 ### h3 trailing hash ###
719 Execute (atx headers):
720 AssertEqual SyntaxOf('# h1 space'), 'htmlH1'
721 AssertEqual SyntaxOf('#h1 nospace'), 'htmlH1'
722 AssertEqual SyntaxOf('# h1 2 spaces'), 'htmlH1'
723 AssertEqual SyntaxOf('# h1 trailing hash #'), 'htmlH1'
724 AssertEqual SyntaxOf('## h2 space'), 'htmlH2'
725 AssertEqual SyntaxOf('##h2 nospace'), 'htmlH2'
726 AssertEqual SyntaxOf('## h2 trailing hash ##'), 'htmlH2'
727 AssertEqual SyntaxOf('### h3 space'), 'htmlH3'
728 AssertEqual SyntaxOf('###h3 nospace'), 'htmlH3'
729 AssertEqual SyntaxOf('### h3 trailing hash ###'), 'htmlH3'
730 AssertEqual SyntaxOf('#### h4'), 'htmlH4'
731 AssertEqual SyntaxOf('##### h5'), 'htmlH5'
732 AssertEqual SyntaxOf('###### h6'), 'htmlH6'
741 Execute (atx headers relative positions):
742 AssertEqual SyntaxOf('# h1 before h2'), 'htmlH1'
743 AssertEqual SyntaxOf('## h2 between h1s'), 'htmlH2'
744 AssertEqual SyntaxOf('# h1 after h2'), 'htmlH1'
753 setex h1 single punctuation
756 setex h1 punctuation longer than header
757 ================================
759 Execute (setex headers):
760 AssertEqual SyntaxOf('setex h1'), 'htmlH1'
761 AssertEqual SyntaxOf('^========$'), 'htmlH1'
762 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
763 AssertEqual SyntaxOf('--------'), 'htmlH2'
764 AssertEqual SyntaxOf('setex h1 single punctuation'), 'htmlH1'
765 AssertEqual SyntaxOf('^=$'), 'htmlH1'
766 AssertEqual SyntaxOf('setex h1 punctuation longer than header'), 'htmlH1'
767 AssertEqual SyntaxOf('^================================$'), 'htmlH1'
773 Execute (prevent list vs Setex confusion):
774 AssertNotEqual SyntaxOf('- not Setex'), 'htmlH2'
775 AssertNotEqual SyntaxOf('- becuase list'), 'htmlH2'
792 Execute (mixed atx and setex headers):
793 AssertEqual SyntaxOf('setex h1 before atx'), 'htmlH1'
794 AssertEqual SyntaxOf('==================='), 'htmlH1'
795 AssertEqual SyntaxOf('## atx h2'), 'htmlH2'
796 AssertEqual SyntaxOf('### atx h3'), 'htmlH3'
797 AssertEqual SyntaxOf('# atx h1'), 'htmlH1'
798 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
799 AssertEqual SyntaxOf('------------------'), 'htmlH2'
807 Execute (& and > are not marked as htmlError in lists):
808 AssertEqual SyntaxOf('-'), 'mkdListItem'
809 AssertEqual SyntaxOf('1.'), 'mkdListItem'
810 AssertNotEqual SyntaxOf('&'), 'htmlError'
811 AssertNotEqual SyntaxOf('>'), 'htmlError'
817 Execute (list after line break):
818 AssertEqual SyntaxOf('1'), 'mkdListItem'
819 AssertEqual SyntaxOf('2'), 'mkdListItem'
830 Execute (HTML tag in text):
831 AssertEqual SyntaxOf('p'), 'htmlTagName'
832 AssertEqual SyntaxOf('<p>'), 'htmlTag'
833 AssertEqual SyntaxOf('</p>'), 'htmlEndTag'
834 AssertEqual SyntaxOf('span'), 'htmlTagName'
835 AssertEqual SyntaxOf('<span>'), 'htmlTag'
836 AssertEqual SyntaxOf('</span>'), 'htmlEndTag'