@@ -311,26 +311,38 @@ fn test_header() {
311
311
assert_eq ! ( output, expect, "original: {}" , input) ;
312
312
}
313
313
314
- t ( "# Foo bar" , "<h2 id=\" foo-bar\" ><a href=\" #foo-bar\" >Foo bar</a></h2>" ) ;
314
+ t (
315
+ "# Foo bar" ,
316
+ "<h2 id=\" foo-bar\" ><a class=\" doc-anchor\" href=\" #foo-bar\" >§</a>Foo bar</h2>" ,
317
+ ) ;
315
318
t (
316
319
"## Foo-bar_baz qux" ,
317
320
"<h3 id=\" foo-bar_baz-qux\" >\
318
- <a href=\" #foo-bar_baz-qux\" >Foo-bar_baz qux</a></h3>",
321
+ <a class=\" doc-anchor\" href=\" #foo-bar_baz-qux\" >§</a>\
322
+ Foo-bar_baz qux\
323
+ </h3>",
319
324
) ;
320
325
t (
321
326
"### **Foo** *bar* baz!?!& -_qux_-%" ,
322
327
"<h4 id=\" foo-bar-baz--qux-\" >\
323
- <a href=\" #foo-bar-baz--qux-\" ><strong>Foo</strong> \
324
- <em>bar</em> baz!?!& -<em>qux</em>-%</a> \
328
+ <a class= \" doc-anchor \" href=\" #foo-bar-baz--qux-\" >§</a> \
329
+ <strong>Foo</strong> < em>bar</em> baz!?!& -<em>qux</em>-%\
325
330
</h4>",
326
331
) ;
327
332
t (
328
333
"#### **Foo?** & \\ *bar?!* _`baz`_ ❤ #qux" ,
329
334
"<h5 id=\" foo--bar--baz--qux\" >\
330
- <a href=\" #foo--bar--baz--qux\" ><strong>Foo?</strong> & *bar?!* \
331
- <em><code>baz</code></em> ❤ #qux</a> \
335
+ <a class= \" doc-anchor \" href=\" #foo--bar--baz--qux\" >§</a> \
336
+ <strong>Foo?</strong> & *bar?!* < em><code>baz</code></em> ❤ #qux\
332
337
</h5>",
333
338
) ;
339
+ t (
340
+ "# Foo [bar](https://hello.yo)" ,
341
+ "<h2 id=\" foo-bar\" >\
342
+ <a class=\" doc-anchor\" href=\" #foo-bar\" >§</a>\
343
+ Foo <a href=\" https://hello.yo\" >bar</a>\
344
+ </h2>",
345
+ ) ;
334
346
}
335
347
336
348
#[ test]
@@ -351,12 +363,36 @@ fn test_header_ids_multiple_blocks() {
351
363
assert_eq ! ( output, expect, "original: {}" , input) ;
352
364
}
353
365
354
- t ( & mut map, "# Example" , "<h2 id=\" example\" ><a href=\" #example\" >Example</a></h2>" ) ;
355
- t ( & mut map, "# Panics" , "<h2 id=\" panics\" ><a href=\" #panics\" >Panics</a></h2>" ) ;
356
- t ( & mut map, "# Example" , "<h2 id=\" example-1\" ><a href=\" #example-1\" >Example</a></h2>" ) ;
357
- t ( & mut map, "# Search" , "<h2 id=\" search-1\" ><a href=\" #search-1\" >Search</a></h2>" ) ;
358
- t ( & mut map, "# Example" , "<h2 id=\" example-2\" ><a href=\" #example-2\" >Example</a></h2>" ) ;
359
- t ( & mut map, "# Panics" , "<h2 id=\" panics-1\" ><a href=\" #panics-1\" >Panics</a></h2>" ) ;
366
+ t (
367
+ & mut map,
368
+ "# Example" ,
369
+ "<h2 id=\" example\" ><a class=\" doc-anchor\" href=\" #example\" >§</a>Example</h2>" ,
370
+ ) ;
371
+ t (
372
+ & mut map,
373
+ "# Panics" ,
374
+ "<h2 id=\" panics\" ><a class=\" doc-anchor\" href=\" #panics\" >§</a>Panics</h2>" ,
375
+ ) ;
376
+ t (
377
+ & mut map,
378
+ "# Example" ,
379
+ "<h2 id=\" example-1\" ><a class=\" doc-anchor\" href=\" #example-1\" >§</a>Example</h2>" ,
380
+ ) ;
381
+ t (
382
+ & mut map,
383
+ "# Search" ,
384
+ "<h2 id=\" search-1\" ><a class=\" doc-anchor\" href=\" #search-1\" >§</a>Search</h2>" ,
385
+ ) ;
386
+ t (
387
+ & mut map,
388
+ "# Example" ,
389
+ "<h2 id=\" example-2\" ><a class=\" doc-anchor\" href=\" #example-2\" >§</a>Example</h2>" ,
390
+ ) ;
391
+ t (
392
+ & mut map,
393
+ "# Panics" ,
394
+ "<h2 id=\" panics-1\" ><a class=\" doc-anchor\" href=\" #panics-1\" >§</a>Panics</h2>" ,
395
+ ) ;
360
396
}
361
397
362
398
#[ test]
0 commit comments