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.
2 unlet! b:mkd_known_filetypes
3 unlet! b:mkd_included_filetypes
4 unlet! g:vim_markdown_math
10 AssertNotEqual SyntaxOf('a'), 'htmlBold'
11 AssertEqual SyntaxOf('b'), 'htmlBold'
12 AssertNotEqual SyntaxOf('c'), 'htmlBold'
18 AssertNotEqual SyntaxOf('a'), 'htmlBold'
19 AssertEqual SyntaxOf('b'), 'htmlBold'
20 AssertNotEqual SyntaxOf('c'), 'htmlBold'
26 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
27 AssertEqual SyntaxOf('b'), 'htmlItalic'
28 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
34 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
35 AssertEqual SyntaxOf('b'), 'htmlItalic'
36 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
41 Execute (italic text has underscores):
42 AssertEqual SyntaxOf('a'), 'htmlItalic'
43 AssertEqual SyntaxOf('b'), 'htmlItalic'
48 Execute (not italic with escaped asterisks):
49 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
50 AssertNotEqual SyntaxOf('b'), 'htmlItalic'
51 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
56 Execute (not italic with escaped underscores):
57 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
58 AssertNotEqual SyntaxOf('b'), 'htmlItalic'
59 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
64 Execute (italic with escaped underscores):
65 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
66 AssertEqual SyntaxOf('b'), 'htmlItalic'
67 AssertEqual SyntaxOf('c'), 'htmlItalic'
68 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
73 Execute (not italic underscores within text):
74 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
75 AssertNotEqual SyntaxOf('b'), 'htmlItalic'
76 AssertNotEqual SyntaxOf('c'), 'htmlItalic'
81 Execute (italic with escaped asterisks):
82 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
83 AssertEqual SyntaxOf('b'), 'htmlItalic'
84 AssertEqual SyntaxOf('c'), 'htmlItalic'
85 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
90 Execute (bold with escaped underscores):
91 AssertNotEqual SyntaxOf('a'), 'htmlBold'
92 AssertEqual SyntaxOf('b'), 'htmlBold'
93 AssertEqual SyntaxOf('c'), 'htmlBold'
94 AssertNotEqual SyntaxOf('d'), 'htmlBold'
100 Execute (italic with underscores in multiple lines):
101 AssertEqual SyntaxOf('a'), 'htmlItalic'
102 AssertEqual SyntaxOf('b'), 'htmlItalic'
103 AssertEqual SyntaxOf('c'), 'htmlItalic'
104 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
110 Execute (bold with underscores in multiple lines):
111 AssertEqual SyntaxOf('a'), 'htmlBold'
112 AssertEqual SyntaxOf('b'), 'htmlBold'
113 AssertEqual SyntaxOf('c'), 'htmlBold'
114 AssertNotEqual SyntaxOf('d'), 'htmlBold'
120 Execute (bold italic with underscores in multiple lines):
121 AssertEqual SyntaxOf('a'), 'htmlBoldItalic'
122 AssertEqual SyntaxOf('b'), 'htmlBoldItalic'
123 AssertEqual SyntaxOf('c'), 'htmlBoldItalic'
124 AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
130 Execute (italic with asterisks in multiple lines):
131 AssertEqual SyntaxOf('a'), 'htmlItalic'
132 AssertEqual SyntaxOf('b'), 'htmlItalic'
133 AssertEqual SyntaxOf('c'), 'htmlItalic'
134 AssertNotEqual SyntaxOf('d'), 'htmlItalic'
140 Execute (bold with asterisks in multiple lines):
141 AssertEqual SyntaxOf('a'), 'htmlBold'
142 AssertEqual SyntaxOf('b'), 'htmlBold'
143 AssertEqual SyntaxOf('c'), 'htmlBold'
144 AssertNotEqual SyntaxOf('d'), 'htmlBold'
150 Execute (bold italic with asterisks in multiple lines):
151 AssertEqual SyntaxOf('a'), 'htmlBoldItalic'
152 AssertEqual SyntaxOf('b'), 'htmlBoldItalic'
153 AssertEqual SyntaxOf('c'), 'htmlBoldItalic'
154 AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
159 Execute (not italic with an asterisk):
160 AssertNotEqual SyntaxOf('a'), 'htmlItalic'
165 Execute (not bold with double underscores):
166 AssertNotEqual SyntaxOf('_'), 'htmlBold'
167 AssertNotEqual SyntaxOf('a'), 'htmlBold'
168 AssertNotEqual SyntaxOf('b'), 'htmlBold'
173 Execute (conceal italic):
175 setlocal conceallevel=2
176 AssertEqual synconcealed(1, 1)[0], 1
177 AssertEqual synconcealed(1, 2)[0], 0
178 AssertEqual synconcealed(1, 3)[0], 1
179 setlocal conceallevel=0
182 Execute (disable conceal):
184 let g:vim_markdown_conceal=0
186 setlocal conceallevel=2
187 AssertEqual synconcealed(1, 1)[0], 0
188 AssertEqual synconcealed(1, 2)[0], 0
189 AssertEqual synconcealed(1, 3)[0], 0
191 let g:vim_markdown_conceal=1
193 AssertEqual synconcealed(1, 1)[0], 1
194 AssertEqual synconcealed(1, 2)[0], 0
195 AssertEqual synconcealed(1, 3)[0], 1
197 setlocal conceallevel=0
198 unlet g:vim_markdown_conceal
205 Execute (conceal italic):
207 setlocal conceallevel=2
208 AssertEqual synconcealed(1, 1)[0], 1
209 AssertEqual synconcealed(1, 2)[0], 0
210 AssertEqual synconcealed(1, 3)[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
223 let g:vim_markdown_conceal=1
225 AssertEqual synconcealed(1, 1)[0], 1
226 AssertEqual synconcealed(1, 2)[0], 0
227 AssertEqual synconcealed(1, 3)[0], 1
229 setlocal conceallevel=0
230 unlet g:vim_markdown_conceal
237 Execute (conceal bold):
239 setlocal conceallevel=2
240 AssertEqual synconcealed(1, 1)[0], 1
241 AssertEqual synconcealed(1, 2)[0], 1
242 AssertEqual synconcealed(1, 3)[0], 0
243 AssertEqual synconcealed(1, 4)[0], 1
244 AssertEqual synconcealed(1, 5)[0], 1
245 setlocal conceallevel=0
248 Execute (disable conceal):
250 let g:vim_markdown_conceal=0
252 setlocal conceallevel=2
253 AssertEqual synconcealed(1, 1)[0], 0
254 AssertEqual synconcealed(1, 2)[0], 0
255 AssertEqual synconcealed(1, 3)[0], 0
256 AssertEqual synconcealed(1, 4)[0], 0
257 AssertEqual synconcealed(1, 5)[0], 0
259 let g:vim_markdown_conceal=1
261 AssertEqual synconcealed(1, 1)[0], 1
262 AssertEqual synconcealed(1, 2)[0], 1
263 AssertEqual synconcealed(1, 3)[0], 0
264 AssertEqual synconcealed(1, 4)[0], 1
265 AssertEqual synconcealed(1, 5)[0], 1
267 setlocal conceallevel=0
268 unlet g:vim_markdown_conceal
275 Execute (conceal bold):
277 setlocal conceallevel=2
278 AssertEqual synconcealed(1, 1)[0], 1
279 AssertEqual synconcealed(1, 2)[0], 1
280 AssertEqual synconcealed(1, 3)[0], 0
281 AssertEqual synconcealed(1, 4)[0], 1
282 AssertEqual synconcealed(1, 5)[0], 1
283 setlocal conceallevel=0
286 Execute (disable conceal):
288 let g:vim_markdown_conceal=0
290 setlocal conceallevel=2
291 AssertEqual synconcealed(1, 1)[0], 0
292 AssertEqual synconcealed(1, 2)[0], 0
293 AssertEqual synconcealed(1, 3)[0], 0
294 AssertEqual synconcealed(1, 4)[0], 0
295 AssertEqual synconcealed(1, 5)[0], 0
297 let g:vim_markdown_conceal=1
299 AssertEqual synconcealed(1, 1)[0], 1
300 AssertEqual synconcealed(1, 2)[0], 1
301 AssertEqual synconcealed(1, 3)[0], 0
302 AssertEqual synconcealed(1, 4)[0], 1
303 AssertEqual synconcealed(1, 5)[0], 1
305 setlocal conceallevel=0
306 unlet g:vim_markdown_conceal
313 Execute (conceal italic bold):
315 setlocal conceallevel=2
316 AssertEqual synconcealed(1, 1)[0], 1
317 AssertEqual synconcealed(1, 2)[0], 1
318 AssertEqual synconcealed(1, 3)[0], 1
319 AssertEqual synconcealed(1, 4)[0], 0
320 AssertEqual synconcealed(1, 5)[0], 1
321 AssertEqual synconcealed(1, 6)[0], 1
322 AssertEqual synconcealed(1, 7)[0], 1
323 setlocal conceallevel=0
326 Execute (disable conceal):
328 let g:vim_markdown_conceal=0
330 setlocal conceallevel=2
331 AssertEqual synconcealed(1, 1)[0], 0
332 AssertEqual synconcealed(1, 2)[0], 0
333 AssertEqual synconcealed(1, 3)[0], 0
334 AssertEqual synconcealed(1, 4)[0], 0
335 AssertEqual synconcealed(1, 5)[0], 0
336 AssertEqual synconcealed(1, 6)[0], 0
337 AssertEqual synconcealed(1, 7)[0], 0
339 let g:vim_markdown_conceal=1
341 AssertEqual synconcealed(1, 1)[0], 1
342 AssertEqual synconcealed(1, 2)[0], 1
343 AssertEqual synconcealed(1, 3)[0], 1
344 AssertEqual synconcealed(1, 4)[0], 0
345 AssertEqual synconcealed(1, 5)[0], 1
346 AssertEqual synconcealed(1, 6)[0], 1
347 AssertEqual synconcealed(1, 7)[0], 1
349 setlocal conceallevel=0
350 unlet g:vim_markdown_conceal
357 Execute (conceal italic bold):
359 setlocal conceallevel=2
360 AssertEqual synconcealed(1, 1)[0], 1
361 AssertEqual synconcealed(1, 2)[0], 1
362 AssertEqual synconcealed(1, 3)[0], 1
363 AssertEqual synconcealed(1, 4)[0], 0
364 AssertEqual synconcealed(1, 5)[0], 1
365 AssertEqual synconcealed(1, 6)[0], 1
366 AssertEqual synconcealed(1, 7)[0], 1
367 setlocal conceallevel=0
370 Execute (disable conceal):
372 let g:vim_markdown_conceal=0
374 setlocal conceallevel=2
375 AssertEqual synconcealed(1, 1)[0], 0
376 AssertEqual synconcealed(1, 2)[0], 0
377 AssertEqual synconcealed(1, 3)[0], 0
378 AssertEqual synconcealed(1, 4)[0], 0
379 AssertEqual synconcealed(1, 5)[0], 0
380 AssertEqual synconcealed(1, 6)[0], 0
381 AssertEqual synconcealed(1, 7)[0], 0
383 let g:vim_markdown_conceal=1
385 AssertEqual synconcealed(1, 1)[0], 1
386 AssertEqual synconcealed(1, 2)[0], 1
387 AssertEqual synconcealed(1, 3)[0], 1
388 AssertEqual synconcealed(1, 4)[0], 0
389 AssertEqual synconcealed(1, 5)[0], 1
390 AssertEqual synconcealed(1, 6)[0], 1
391 AssertEqual synconcealed(1, 7)[0], 1
393 setlocal conceallevel=0
394 unlet g:vim_markdown_conceal
403 Execute (link with title):
404 AssertEqual SyntaxOf('a'), 'mkdLink'
405 AssertEqual SyntaxOf('b'), 'mkdURL'
411 Execute (link text with newline):
412 AssertEqual SyntaxOf('a'), 'mkdLink'
413 AssertEqual SyntaxOf('b'), 'mkdLink'
414 AssertEqual SyntaxOf('c'), 'mkdURL'
419 Execute (link text with bracket sections):
420 AssertNotEqual SyntaxOf('a'), 'mkdLink'
421 AssertNotEqual SyntaxOf('b'), 'mkdLink'
422 AssertEqual SyntaxOf('c'), 'mkdLink'
423 AssertEqual SyntaxOf('d'), 'mkdURL'
428 Execute (footnote is not link):
429 AssertNotEqual SyntaxOf('a'), 'mkdLinkDef'
436 Execute (parenthesis not in link):
437 AssertNotEqual SyntaxOf('a'), 'mkdURL'
438 AssertNotEqual SyntaxOf('b'), 'mkdURL'
443 Execute (multiple links on a line):
444 AssertNotEqual SyntaxOf('c'), 'mkdLink'
445 AssertNotEqual SyntaxOf('c'), 'mkdURL'
450 Execute (space is not allowed between link text and parenthesis):
451 AssertNotEqual SyntaxOf('a'), 'mkdLink'
452 AssertNotEqual SyntaxOf('b'), 'mkdURL'
457 Execute (conceal link):
459 setlocal conceallevel=2
460 AssertEqual synconcealed(1, 1)[0], 1
461 AssertEqual synconcealed(1, 2)[0], 0
462 AssertEqual synconcealed(1, 3)[0], 1
463 AssertEqual synconcealed(1, 4)[0], 1
464 AssertEqual synconcealed(1, 4)[0], 1
465 AssertEqual synconcealed(1, 5)[0], 1
466 AssertEqual synconcealed(1, 6)[0], 1
467 setlocal conceallevel=0
470 Execute (disable conceal):
472 let g:vim_markdown_conceal=0
474 setlocal conceallevel=2
475 AssertEqual synconcealed(1, 1)[0], 0
476 AssertEqual synconcealed(1, 2)[0], 0
477 AssertEqual synconcealed(1, 3)[0], 0
478 AssertEqual synconcealed(1, 4)[0], 0
479 AssertEqual synconcealed(1, 4)[0], 0
480 AssertEqual synconcealed(1, 5)[0], 0
481 AssertEqual synconcealed(1, 6)[0], 0
483 let g:vim_markdown_conceal=1
485 AssertEqual synconcealed(1, 1)[0], 1
486 AssertEqual synconcealed(1, 2)[0], 0
487 AssertEqual synconcealed(1, 3)[0], 1
488 AssertEqual synconcealed(1, 4)[0], 1
489 AssertEqual synconcealed(1, 4)[0], 1
490 AssertEqual synconcealed(1, 5)[0], 1
491 AssertEqual synconcealed(1, 6)[0], 1
493 setlocal conceallevel=0
494 unlet g:vim_markdown_conceal
504 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
505 AssertEqual SyntaxOf('<'), 'mkdDelimiter'
506 AssertEqual SyntaxOf('b'), 'mkdInlineURL'
507 AssertEqual SyntaxOf('>'), 'mkdDelimiter'
508 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
513 Execute (autolink with domain starting with a number):
514 AssertEqual SyntaxOf('12monkeys'), 'mkdInlineURL'
519 Execute (autolink with scheme case is insensitive):
520 AssertEqual SyntaxOf('a'), 'mkdInlineURL'
525 Execute (autolink without scheme is not a link):
526 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
534 Execute (autolink with space is not a link):
535 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
536 AssertNotEqual SyntaxOf('b'), 'mkdInlineURL'
537 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
538 AssertNotEqual SyntaxOf('d'), 'mkdInlineURL'
539 AssertNotEqual SyntaxOf('e'), 'mkdInlineURL'
544 Execute (autolinks can be backslash escaped):
545 AssertNotEqual SyntaxOf('<'), 'mkdDelimiter'
550 Execute (autolink in parenthesis):
551 AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
552 AssertEqual SyntaxOf('('), 'mkdDelimiter'
553 AssertEqual SyntaxOf('b'), 'mkdInlineURL'
554 AssertEqual SyntaxOf(')'), 'mkdDelimiter'
555 AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
558 [![a](http://b)](http://c)
560 Execute (autolink in link text):
561 AssertEqual SyntaxOf('!'), 'mkdDelimiter'
562 AssertEqual SyntaxOf('a'), 'mkdLink'
563 AssertEqual SyntaxOf('b'), 'mkdURL'
564 AssertEqual SyntaxOf('c'), 'mkdURL'
585 Execute (link in headers):
586 AssertEqual SyntaxOf('h1link'), 'mkdLink'
587 AssertEqual SyntaxOf('h2link'), 'mkdLink'
588 AssertEqual SyntaxOf('h3link'), 'mkdLink'
589 AssertEqual SyntaxOf('h4link'), 'mkdLink'
590 AssertEqual SyntaxOf('h5link'), 'mkdLink'
591 AssertEqual SyntaxOf('h6link'), 'mkdLink'
592 AssertEqual SyntaxOf('h1link_b'), 'mkdLink'
593 AssertEqual SyntaxOf('h2link_b'), 'mkdLink'
600 ### http://h3link.foo
602 #### http://h4link.foo
604 ##### http://h5link.foo
606 ###### http://h6link.foo
614 Execute (inline url in headers):
615 AssertEqual SyntaxOf('h1link'), 'mkdInlineURL'
616 AssertEqual SyntaxOf('h2link'), 'mkdInlineURL'
617 AssertEqual SyntaxOf('h3link'), 'mkdInlineURL'
618 AssertEqual SyntaxOf('h4link'), 'mkdInlineURL'
619 AssertEqual SyntaxOf('h5link'), 'mkdInlineURL'
620 AssertEqual SyntaxOf('h6link'), 'mkdInlineURL'
621 AssertEqual SyntaxOf('h1link_b'), 'mkdInlineURL'
622 AssertEqual SyntaxOf('h2link_b'), 'mkdInlineURL'
628 Execute (link in blockquote):
629 AssertEqual SyntaxOf('a'), 'mkdLink'
630 AssertEqual SyntaxOf('foo'), 'mkdInlineURL'
633 [https://domain.tld](https://domain.com) not_a_link
635 Execute (link with url title):
636 AssertEqual SyntaxOf('https://domain.tld'), 'mkdInlineURL'
637 AssertEqual SyntaxOf('https://domain.com'), 'mkdInlineURL'
638 AssertNotEqual SyntaxOf('not_a_link'), 'mkdInlineURL'
647 Execute (code blocks can be fenced with tildes):
648 AssertEqual SyntaxOf('c'), 'mkdCode'
655 Execute (code blocks can be fenced with tildes longer than 3):
656 AssertEqual SyntaxOf('c'), 'mkdCode'
663 Execute (code blocks can be fenced with backticks longer than 3):
664 AssertEqual SyntaxOf('c'), 'mkdCode'
671 Execute (code blocks can have a language specifier):
672 AssertEqual SyntaxOf('c'), 'mkdCode'
681 Execute (code blocks can be fenced with backticks and a language specifier):
682 AssertEqual SyntaxOf('code'), 'mkdCode'
683 AssertNotEqual SyntaxOf('text'), 'mkdCode'
693 Execute (indent code blocks):
694 AssertNotEqual SyntaxOf('a'), 'mkdCode'
695 AssertEqual SyntaxOf('b'), 'mkdCode'
696 AssertEqual SyntaxOf('c'), 'mkdCode'
705 Execute (indent code blocks after header):
706 AssertNotEqual SyntaxOf('a'), 'mkdCode'
707 AssertNotEqual SyntaxOf('b'), 'mkdCode'
708 AssertEqual SyntaxOf('c'), 'mkdCode'
717 Execute (indent code blocks after list):
718 AssertNotEqual SyntaxOf('a'), 'mkdCode'
719 AssertNotEqual SyntaxOf('b'), 'mkdCode'
720 AssertEqual SyntaxOf('c'), 'mkdCode'
726 Execute (indent code block at beginning of file):
727 AssertEqual SyntaxOf('a'), 'mkdCode'
728 AssertEqual SyntaxOf('b'), 'mkdCode'
741 Execute (fenced code block syntax with a language specifier):
742 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
744 AssertEqual SyntaxOf('include'), 'cInclude'
745 AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
746 AssertEqual SyntaxOf('def'), 'rubyDefine'
769 Execute (fenced code block syntax with a language specifier after whitespace):
770 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
772 AssertEqual SyntaxOf('include'), 'cInclude'
773 AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
774 AssertEqual SyntaxOf('g:a'), 'vimVar'
775 AssertEqual SyntaxOf('def'), 'rubyDefine'
776 AssertNotEqual SyntaxOf('class'), 'rubyClass'
787 Execute (fenced code block syntax with alias language specifier):
788 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
790 AssertEqual SyntaxOf('g:a'), 'vimVar'
791 AssertEqual SyntaxOf('g:b'), 'vimVar'
798 Execute (fenced code block languages setting):
799 let g:vim_markdown_fenced_languages = ['csharp=cs']
800 source ../ftplugin/markdown.vim
801 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
803 AssertEqual SyntaxOf('foo'), 'csString'
804 unlet g:vim_markdown_fenced_languages
811 Execute (fenced code block includes language syntax with reopening same buffer):
812 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
817 set filetype=markdown
818 execute "normal! i```vim\<cr>let g:a = 1\<cr>```"
820 AssertEqual SyntaxOf('g:a'), 'vimVar'
827 Execute (fenced code block syntax with an unknown language specifier):
828 let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
830 AssertEqual SyntaxOf('code'), 'mkdSnippetA_B_'
839 Execute (first = or - in fenced code block is not setex headers):
840 AssertEqual SyntaxOf('='), 'mkdCode'
841 AssertEqual SyntaxOf('-'), 'mkdCode'
848 Execute (fenced code block with extended info strings):
849 AssertEqual SyntaxOf('a'), 'mkdCode'
851 # Code Blocks in pre and code tag
858 Execute (code block in pre tag):
859 AssertEqual SyntaxOf('a'), 'mkdCode'
866 Execute (code block in code tag):
867 AssertEqual SyntaxOf('a'), 'mkdCode'
874 Execute (not code block in escaped pre tag):
875 AssertNotEqual SyntaxOf('a'), 'mkdCode'
882 Execute (not code block in escaped code tag):
883 AssertNotEqual SyntaxOf('a'), 'mkdCode'
890 Execute (code in code quotes):
891 AssertEqual SyntaxOf('a'), 'mkdCode'
896 Execute (code quotes not escaped ending with backslash):
897 AssertEqual SyntaxOf('a\'), 'mkdCode'
898 AssertNotEqual SyntaxOf('b'), 'mkdCode'
899 AssertEqual SyntaxOf('c\'), 'mkdCode'
900 AssertNotEqual SyntaxOf('d'), 'mkdCode'
905 Execute (double code quotes not escaped ending with backslash):
906 AssertEqual SyntaxOf('a\'), 'mkdCode'
907 AssertNotEqual SyntaxOf('b'), 'mkdCode'
908 AssertEqual SyntaxOf('c`\\`1'), 'mkdCode'
909 AssertNotEqual SyntaxOf('d'), 'mkdCode'
920 AssertNotEqual SyntaxOf('x')[0:2], 'tex'
921 AssertNotEqual SyntaxOf('y')[0:2], 'tex'
922 let g:vim_markdown_math=1
924 AssertNotEqual SyntaxOf('a')[0:2], 'tex'
925 AssertNotEqual SyntaxOf('b')[0:2], 'tex'
926 AssertNotEqual SyntaxOf('c')[0:2], 'tex'
927 AssertNotEqual SyntaxOf('d')[0:2], 'tex'
928 AssertNotEqual SyntaxOf('e')[0:2], 'tex'
929 AssertNotEqual SyntaxOf('f')[0:2], 'tex'
930 AssertEqual SyntaxOf('x')[0:2], 'tex'
931 AssertEqual SyntaxOf('y')[0:2], 'tex'
932 let g:vim_markdown_math=0
934 AssertNotEqual SyntaxOf('x')[0:2], 'tex'
935 AssertNotEqual SyntaxOf('y')[0:2], 'tex'
946 Execute (multiline math):
947 let g:vim_markdown_math=1
949 AssertNotEqual SyntaxOf('a')[0:2], 'tex'
950 AssertEqual SyntaxOf('b')[0:2], 'tex'
951 AssertNotEqual SyntaxOf('c')[0:2], 'tex'
957 Execute (math tex highlighting):
958 let g:vim_markdown_math=0
960 AssertNotEqual SyntaxOf('sqrt'), 'texStatement'
961 AssertNotEqual SyntaxOf('frac'), 'texStatement'
962 let g:vim_markdown_math=1
964 AssertEqual SyntaxOf('sqrt'), 'texStatement'
965 AssertEqual SyntaxOf('frac'), 'texStatement'
970 Execute (math ends with $):
971 let g:vim_markdown_math=1
973 AssertEqual SyntaxOf('a')[0:2], 'tex'
974 AssertEqual SyntaxOf('b')[0:2], 'tex'
975 AssertNotEqual SyntaxOf('c')[0:2], 'tex'
980 Execute (math ends with $$):
981 let g:vim_markdown_math=1
983 AssertEqual SyntaxOf('a')[0:2], 'tex'
984 AssertEqual SyntaxOf('b')[0:2], 'tex'
985 AssertNotEqual SyntaxOf('c')[0:2], 'tex'
990 Execute (math conceal in $):
992 setlocal conceallevel=2
993 let g:vim_markdown_math=1
995 AssertEqual synconcealed(1, 1)[0], 1, '$'
996 AssertEqual synconcealed(1, 2)[0], 0
997 AssertEqual synconcealed(1, 3)[0], 0
998 AssertEqual synconcealed(1, 4)[0], 0
999 AssertEqual synconcealed(1, 5)[0], 1, '\le'
1000 AssertEqual synconcealed(1, 6)[0], 1
1001 AssertEqual synconcealed(1, 7)[0], 1
1002 AssertEqual synconcealed(1, 8)[0], 0
1003 AssertEqual synconcealed(1, 9)[0], 0
1004 AssertEqual synconcealed(1, 10)[0], 0
1005 AssertEqual synconcealed(1, 11)[0], 1, '$'
1006 setlocal conceallevel=0
1015 Execute (math conceal in $$):
1017 setlocal conceallevel=2
1018 let g:vim_markdown_math=1
1020 AssertEqual synconcealed(1, 1)[0], 1, '$$'
1021 AssertEqual synconcealed(2, 1)[0], 1, '\omega'
1022 AssertEqual synconcealed(3, 1)[0], 0, '0'
1023 AssertEqual synconcealed(3, 3)[0], 1, '\le'
1024 AssertEqual synconcealed(3, 7)[0], 0, '1'
1025 AssertEqual synconcealed(4, 1)[0], 1, '$$'
1026 setlocal conceallevel=0
1036 Execute (YAML frontmatter is controlled by the option):
1037 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
1038 let g:vim_markdown_frontmatter=1
1040 AssertEqual SyntaxOf('a')[0:3], 'yaml'
1041 let g:vim_markdown_frontmatter=0
1043 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
1051 Execute (YAML frontmatter only works if it's the first thing in the file):
1052 let g:vim_markdown_frontmatter=1
1054 AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
1063 Execute (rules are not mistaken by YAML frontmatter delimiters):
1064 let g:vim_markdown_frontmatter=1
1066 AssertEqual SyntaxAt(5, 1), 'mkdRule'
1067 unlet g:vim_markdown_frontmatter
1076 Execute (TOML frontmatter is controlled by the option):
1078 AssertNotEqual SyntaxOf('b'), 'tomlString'
1079 let g:vim_markdown_toml_frontmatter=1
1081 AssertEqual SyntaxOf('b'), 'tomlString'
1082 let g:vim_markdown_toml_frontmatter=0
1084 AssertNotEqual SyntaxOf('b'), 'tomlString'
1092 Execute (TOML frontmatter only works if it's the first thing in the file):
1093 let g:vim_markdown_toml_frontmatter=1
1095 AssertNotEqual SyntaxOf('b'), 'tomlString'
1096 unlet g:vim_markdown_toml_frontmatter
1105 Execute (JSON frontmatter is controlled by the option):
1107 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
1108 let g:vim_markdown_json_frontmatter=1
1110 AssertEqual SyntaxOf('a'), 'jsonKeyword'
1111 let g:vim_markdown_json_frontmatter=0
1113 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
1121 Execute (JSON frontmatter only works if it's the first thing in the file):
1122 let g:vim_markdown_json_frontmatter=1
1124 AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
1125 unlet g:vim_markdown_json_frontmatter
1136 Execute (header title starts with #):
1137 AssertEqual SyntaxOf('a'), 'htmlH1'
1138 AssertEqual SyntaxOf('b'), 'htmlH2'
1147 # h1 trailing hash #
1153 ## h2 trailing hash ##
1159 ### h3 trailing hash ###
1167 Execute (atx headers):
1168 AssertEqual SyntaxOf(' h1 space'), 'htmlH1'
1169 AssertEqual SyntaxOf('h1 nospace'), 'htmlH1'
1170 AssertEqual SyntaxOf(' h1 2 spaces'), 'htmlH1'
1171 AssertEqual SyntaxOf(' h1 trailing hash '), 'htmlH1'
1172 AssertEqual SyntaxOf(' h2 space'), 'htmlH2'
1173 AssertEqual SyntaxOf('h2 nospace'), 'htmlH2'
1174 AssertEqual SyntaxOf(' h2 trailing hash '), 'htmlH2'
1175 AssertEqual SyntaxOf(' h3 space'), 'htmlH3'
1176 AssertEqual SyntaxOf('h3 nospace'), 'htmlH3'
1177 AssertEqual SyntaxOf(' h3 trailing hash '), 'htmlH3'
1178 AssertEqual SyntaxOf(' h4'), 'htmlH4'
1179 AssertEqual SyntaxOf(' h5'), 'htmlH5'
1180 AssertEqual SyntaxOf(' h6'), 'htmlH6'
1189 Execute (atx headers relative positions):
1190 AssertEqual SyntaxOf(' h1 before h2'), 'htmlH1'
1191 AssertEqual SyntaxOf(' h2 between h1s'), 'htmlH2'
1192 AssertEqual SyntaxOf(' h1 after h2'), 'htmlH1'
1201 setex h1 single punctuation
1204 setex h1 punctuation longer than header
1205 ================================
1207 Execute (setex headers):
1208 AssertEqual SyntaxOf('setex h1'), 'htmlH1'
1209 AssertEqual SyntaxOf('^========$'), 'htmlH1'
1210 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
1211 AssertEqual SyntaxOf('--------'), 'htmlH2'
1212 AssertEqual SyntaxOf('setex h1 single punctuation'), 'htmlH1'
1213 AssertEqual SyntaxOf('^=$'), 'htmlH1'
1214 AssertEqual SyntaxOf('setex h1 punctuation longer than header'), 'htmlH1'
1215 AssertEqual SyntaxOf('^================================$'), 'htmlH1'
1221 Execute (prevent list vs Setex confusion):
1222 AssertNotEqual SyntaxOf('- not Setex'), 'htmlH2'
1223 AssertNotEqual SyntaxOf('- becuase list'), 'htmlH2'
1240 Execute (mixed atx and setex headers):
1241 AssertEqual SyntaxOf('setex h1 before atx'), 'htmlH1'
1242 AssertEqual SyntaxOf('==================='), 'htmlH1'
1243 AssertEqual SyntaxOf(' atx h2'), 'htmlH2'
1244 AssertEqual SyntaxOf(' atx h3'), 'htmlH3'
1245 AssertEqual SyntaxOf(' atx h1'), 'htmlH1'
1246 AssertEqual SyntaxOf('setex h2'), 'htmlH2'
1247 AssertEqual SyntaxOf('------------------'), 'htmlH2'
1255 Execute (& and > are not marked as htmlError in lists):
1256 AssertEqual SyntaxOf('-'), 'mkdListItem'
1257 AssertEqual SyntaxOf('1.'), 'mkdListItem'
1258 AssertNotEqual SyntaxOf('&'), 'htmlError'
1259 AssertNotEqual SyntaxOf('>'), 'htmlError'
1265 Execute (list after line break):
1266 AssertEqual SyntaxOf('1'), 'mkdListItem'
1267 AssertEqual SyntaxOf('2'), 'mkdListItem'
1278 Execute (HTML tag in text):
1279 AssertEqual SyntaxOf('p'), 'htmlTagName'
1280 AssertEqual SyntaxOf('<p>'), 'htmlTag'
1281 AssertEqual SyntaxOf('</p>'), 'htmlEndTag'
1282 AssertEqual SyntaxOf('span'), 'htmlTagName'
1283 AssertEqual SyntaxOf('<span>'), 'htmlTag'
1284 AssertEqual SyntaxOf('</span>'), 'htmlEndTag'