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 let g:vim_markdown_folding_style_pythonic = 1
3 source ../after/ftplugin/markdown.vim
7 setlocal foldmethod=manual
16 # This is just a comment
23 Execute (fold level # in code block):
24 AssertEqual foldlevel(1), 0, '# Title'
25 AssertEqual foldlevel(3), 1, '## Chapter 1'
26 AssertEqual foldlevel(7), 1, '# This is just a comment'
27 AssertEqual foldlevel(8), 1, '```'
28 AssertEqual foldlevel(10), 1, '## Chapter 2'
29 AssertEqual foldlevel(12), 1, 'foobar'
31 Execute (fold text of chapters):
32 let b:width = winwidth(0)
33 let b:hyphen = repeat('-', b:width - 18 > 2 ? b:width - 18 : b:width - 9 > 0 ? 3 : 2)
34 AssertEqual foldtextresult(3), strpart('## Chapter 1', 0, b:width - 9) . ' ' . b:hyphen . ' 6'
35 AssertEqual foldtextresult(10), strpart('## Chapter 2', 0, b:width - 9) . ' ' . b:hyphen . ' 2'
43 Execute (fold level ==, --):
44 AssertEqual foldlevel(2), 0, '=='
45 AssertEqual foldlevel(4), 1, '--'
47 Execute (fold text of ==, --):
48 let b:width = winwidth(0)
49 let b:hyphen = repeat('-', b:width - 17 > 2 ? b:width - 17 : b:width - 9 > 0 ? 3 : 2)
50 AssertEqual foldtextresult(3), strpart('Fold text 2', 0, b:width - 9) . ' ' . b:hyphen . ' 1'
59 Execute (fold any preamble):
60 AssertEqual foldlevel(1), 1, 'Headline'
61 AssertEqual foldlevel(3), 1, 'foobar'
62 AssertEqual foldlevel(5), 0, '# Title'
67 title: A test of the heading folding when there is YAML frontmatter
68 tags: markdown yaml vim-markdown
75 Execute (fold level of yaml front matter):
76 let g:vim_markdown_frontmatter = 1
77 source ../after/ftplugin/markdown.vim
78 AssertEqual foldlevel(1), 1, '---'
79 AssertEqual foldlevel(2), 1, 'layout: article'
80 AssertEqual foldlevel(4), 1, 'tags: markdown yaml vim-markdown'
81 AssertEqual foldlevel(5), 1, '---'
82 AssertEqual foldlevel(6), 1, 'body'
83 AssertEqual foldlevel(8), 1, 'heading'
84 AssertEqual foldlevel(9), 1, '-------'
85 unlet g:vim_markdown_frontmatter