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.
1 " Tests atx and setext folding, and :Toc.
4 source ../after/ftplugin/markdown.vim
8 setlocal foldmethod=manual
20 # this is another comment
71 AssertEqual foldlevel(1), 0, '# chap 1'
72 AssertEqual foldlevel(3), 1, 'hello'
73 AssertEqual foldlevel(6), 1, '```bash'
74 AssertEqual foldlevel(7), 1, '# some bash scripting'
75 AssertEqual foldlevel(15), 1, '## chap 1.1'
76 AssertEqual foldlevel(21), 2, 'mkdir foo'
77 AssertEqual foldlevel(22), 2, 'comment in ~'
78 AssertEqual foldlevel(25), 2, '### chap 1.1.1'
79 AssertEqual foldlevel(27), 3, '- dragons'
80 AssertEqual foldlevel(30), 1, '# chap 2'
81 AssertEqual foldlevel(32), 1, 'another'
82 AssertEqual foldlevel(34), 1, '# chap 2.1'
83 AssertEqual foldlevel(37), 2, '- japan'
84 AssertEqual foldlevel(41), 1, '# chap 3'
85 AssertEqual foldlevel(45), 1, 'chap 4\n======'
86 AssertEqual foldlevel(48), 1, 'setext are evil'
87 AssertEqual foldlevel(50), 2, 'chap 4.1\n------'
89 Execute (fold text result):
90 AssertEqual foldtextresult(2), '+-- 28 lines: hello'
91 AssertEqual foldtextresult(31), '+-- 10 lines: another'
92 AssertEqual foldtextresult(42), '+-- 3 lines: nothing here'
93 AssertEqual foldtextresult(45), '+-- 14 lines: chap 4'
95 Execute (fold level with setting):
96 let g:vim_markdown_folding_level = 2
97 source ../after/ftplugin/markdown.vim
98 AssertEqual foldlevel(1), 0, '# chap 1'
99 AssertEqual foldlevel(3), 1, 'hello'
100 AssertEqual foldlevel(6), 1, '```bash'
101 AssertEqual foldlevel(7), 1, '# some bash scripting'
102 AssertEqual foldlevel(15), 0, '## chap 1.1'
103 AssertEqual foldlevel(21), 2, 'mkdir foo'
104 AssertEqual foldlevel(22), 2, 'comment in ~'
105 AssertEqual foldlevel(25), 2, '### chap 1.1.1'
106 AssertEqual foldlevel(27), 3, '- dragons'
107 AssertEqual foldlevel(30), 0, '# chap 2'
108 AssertEqual foldlevel(32), 1, 'another'
109 AssertEqual foldlevel(34), 0, '# chap 2.1'
110 AssertEqual foldlevel(37), 2, '- japan'
111 AssertEqual foldlevel(41), 0, '# chap 3'
112 AssertEqual foldlevel(45), 1, 'chap 4\n======'
113 AssertEqual foldlevel(48), 1, 'setext are evil'
114 AssertEqual foldlevel(50), 1, 'chap 4.1\n------'
115 let g:vim_markdown_folding_level = 0
120 let res = getloclist(0)
122 AssertEqual elem.lnum, 1
123 AssertEqual elem.text, '# chap 1'
125 AssertEqual elem.lnum, 15
126 AssertEqual elem.text, '## chap 1.1'
128 AssertEqual elem.lnum, 25
129 AssertEqual elem.text, '### chap 1.1.1'
131 AssertEqual elem.lnum, 30
132 AssertEqual elem.text, '# chap 2'
134 AssertEqual elem.lnum, 34
135 AssertEqual elem.text, '## chap 2.1'
137 AssertEqual elem.lnum, 41
138 AssertEqual elem.text, '# chap 3'
140 AssertEqual elem.lnum, 45
141 AssertEqual elem.text, 'chap 4'
143 AssertEqual elem.lnum, 50
144 AssertEqual elem.text, 'chap 4.1'