File tree 3 files changed +16
-13
lines changed
3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 48
48
" For each level, contains the regexp that matches at that level only.
49
49
"
50
50
let s: levelRegexpDict = {
51
- \ 1 : ' \v^(#[^#]@=|.+\n\=+$)' ,
52
- \ 2 : ' \v^(##[^#]@=|.+\n-+$)' ,
53
- \ 3 : ' \v^###[^#]@=' ,
54
- \ 4 : ' \v^####[^#]@=' ,
55
- \ 5 : ' \v^#####[^#]@=' ,
56
- \ 6 : ' \v^######[^#]@='
51
+ \ 1 : ' \v^(#[^#]@=\s+ |.+\n\=+$)' ,
52
+ \ 2 : ' \v^(##[^#]@=\s+ |.+\n-+$)' ,
53
+ \ 3 : ' \v^###[^#]@=\s+ ' ,
54
+ \ 4 : ' \v^####[^#]@=\s+ ' ,
55
+ \ 5 : ' \v^#####[^#]@=\s+ ' ,
56
+ \ 6 : ' \v^######[^#]@=\s+ '
57
57
\ }
58
58
59
59
" Maches any header level of any type.
60
60
"
61
61
" This could be deduced from `s:levelRegexpDict`, but it is more
62
62
" efficient to have a single regexp for this.
63
63
"
64
- let s: headersRegexp = ' \v^(#|.+\n(\=+|-+)$)'
64
+ let s: headersRegexp = ' \v^(#{1,6}\s+ |.+\n(\=+|-+)$)'
65
65
66
66
" Returns the line number of the first header before `line`, called the
67
67
" current header.
Original file line number Diff line number Diff line change @@ -94,14 +94,16 @@ Given markdown;
94
94
95
95
b
96
96
97
+ #ignore
98
+
97
99
# c
98
100
99
101
d
100
102
101
103
Execute (]] same level):
102
104
AssertEqual line('.'), 1
103
105
normal ]]
104
- AssertEqual line('.'), 5
106
+ AssertEqual line('.'), 7
105
107
normal [[
106
108
AssertEqual line('.'), 1
107
109
@@ -110,14 +112,16 @@ Given markdown;
110
112
111
113
b
112
114
115
+ ##ignore
116
+
113
117
## c
114
118
115
119
d
116
120
117
121
Execute (]] different levels level):
118
122
AssertEqual line('.'), 1
119
123
normal ]]
120
- AssertEqual line('.'), 5
124
+ AssertEqual line('.'), 7
121
125
normal [[
122
126
AssertEqual line('.'), 1
123
127
@@ -126,6 +130,8 @@ Given markdown;
126
130
127
131
b
128
132
133
+ #ignore
134
+
129
135
## c
130
136
131
137
d
137
143
Execute (][ different levels level):
138
144
AssertEqual line('.'), 1
139
145
normal ][
140
- AssertEqual line('.'), 9
146
+ AssertEqual line('.'), 11
141
147
normal []
142
148
AssertEqual line('.'), 1
143
149
Original file line number Diff line number Diff line change @@ -138,14 +138,11 @@ Execute (Toc multiple headers):
138
138
139
139
Expect (multiple headers):
140
140
h1 space
141
- h1 nospace
142
141
h1 2 spaces
143
142
h1 trailing hash
144
143
h2 space
145
- h2 nospace
146
144
h2 trailing hash
147
145
h3 space
148
- h3 nospace
149
146
h3 trailing hash
150
147
h4
151
148
h5
You can’t perform that action at this time.
0 commit comments