@@ -159,24 +159,29 @@ fn test_header() {
159
159
assert_eq ! ( output, expect, "original: {}" , input) ;
160
160
}
161
161
162
- t ( "# Foo bar" , "<h2 id=\" foo-bar\" ><a href=\" #foo-bar\" >Foo bar</a></h2>" ) ;
162
+ t (
163
+ "# Foo bar" ,
164
+ "<h2 id=\" foo-bar\" ><a class=\" doc-anchor\" href=\" #foo-bar\" >§</a>Foo bar</h2>" ,
165
+ ) ;
163
166
t (
164
167
"## Foo-bar_baz qux" ,
165
168
"<h3 id=\" foo-bar_baz-qux\" >\
166
- <a href=\" #foo-bar_baz-qux\" >Foo-bar_baz qux</a></h3>",
169
+ <a class=\" doc-anchor\" href=\" #foo-bar_baz-qux\" >§</a>\
170
+ Foo-bar_baz qux\
171
+ </h3>",
167
172
) ;
168
173
t (
169
174
"### **Foo** *bar* baz!?!& -_qux_-%" ,
170
175
"<h4 id=\" foo-bar-baz--qux-\" >\
171
- <a href=\" #foo-bar-baz--qux-\" ><strong>Foo</strong> \
172
- <em>bar</em> baz!?!& -<em>qux</em>-%</a> \
176
+ <a class= \" doc-anchor \" href=\" #foo-bar-baz--qux-\" >§</a> \
177
+ <strong>Foo</strong> < em>bar</em> baz!?!& -<em>qux</em>-%\
173
178
</h4>",
174
179
) ;
175
180
t (
176
181
"#### **Foo?** & \\ *bar?!* _`baz`_ ❤ #qux" ,
177
182
"<h5 id=\" foo--bar--baz--qux\" >\
178
- <a href=\" #foo--bar--baz--qux\" ><strong>Foo?</strong> & *bar?!* \
179
- <em><code>baz</code></em> ❤ #qux</a> \
183
+ <a class= \" doc-anchor \" href=\" #foo--bar--baz--qux\" >§</a> \
184
+ <strong>Foo?</strong> & *bar?!* < em><code>baz</code></em> ❤ #qux\
180
185
</h5>",
181
186
) ;
182
187
}
@@ -198,12 +203,36 @@ fn test_header_ids_multiple_blocks() {
198
203
assert_eq ! ( output, expect, "original: {}" , input) ;
199
204
}
200
205
201
- t ( & mut map, "# Example" , "<h2 id=\" example\" ><a href=\" #example\" >Example</a></h2>" ) ;
202
- t ( & mut map, "# Panics" , "<h2 id=\" panics\" ><a href=\" #panics\" >Panics</a></h2>" ) ;
203
- t ( & mut map, "# Example" , "<h2 id=\" example-1\" ><a href=\" #example-1\" >Example</a></h2>" ) ;
204
- t ( & mut map, "# Search" , "<h2 id=\" search-1\" ><a href=\" #search-1\" >Search</a></h2>" ) ;
205
- t ( & mut map, "# Example" , "<h2 id=\" example-2\" ><a href=\" #example-2\" >Example</a></h2>" ) ;
206
- t ( & mut map, "# Panics" , "<h2 id=\" panics-1\" ><a href=\" #panics-1\" >Panics</a></h2>" ) ;
206
+ t (
207
+ & mut map,
208
+ "# Example" ,
209
+ "<h2 id=\" example\" ><a class=\" doc-anchor\" href=\" #example\" >§</a>Example</h2>" ,
210
+ ) ;
211
+ t (
212
+ & mut map,
213
+ "# Panics" ,
214
+ "<h2 id=\" panics\" ><a class=\" doc-anchor\" href=\" #panics\" >§</a>Panics</h2>" ,
215
+ ) ;
216
+ t (
217
+ & mut map,
218
+ "# Example" ,
219
+ "<h2 id=\" example-1\" ><a class=\" doc-anchor\" href=\" #example-1\" >§</a>Example</h2>" ,
220
+ ) ;
221
+ t (
222
+ & mut map,
223
+ "# Search" ,
224
+ "<h2 id=\" search-1\" ><a class=\" doc-anchor\" href=\" #search-1\" >§</a>Search</h2>" ,
225
+ ) ;
226
+ t (
227
+ & mut map,
228
+ "# Example" ,
229
+ "<h2 id=\" example-2\" ><a class=\" doc-anchor\" href=\" #example-2\" >§</a>Example</h2>" ,
230
+ ) ;
231
+ t (
232
+ & mut map,
233
+ "# Panics" ,
234
+ "<h2 id=\" panics-1\" ><a class=\" doc-anchor\" href=\" #panics-1\" >§</a>Panics</h2>" ,
235
+ ) ;
207
236
}
208
237
209
238
#[ test]
0 commit comments