@@ -311,24 +311,29 @@ fn test_header() {
311311 assert_eq ! ( output, expect, "original: {}" , input) ;
312312 }
313313
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+ ) ;
315318 t (
316319 "## Foo-bar_baz qux" ,
317320 "<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>",
319324 ) ;
320325 t (
321326 "### **Foo** *bar* baz!?!& -_qux_-%" ,
322327 "<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>-%\
325330 </h4>",
326331 ) ;
327332 t (
328333 "#### **Foo?** & \\ *bar?!* _`baz`_ ❤ #qux" ,
329334 "<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\
332337 </h5>",
333338 ) ;
334339}
@@ -351,12 +356,36 @@ fn test_header_ids_multiple_blocks() {
351356 assert_eq ! ( output, expect, "original: {}" , input) ;
352357 }
353358
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>" ) ;
359+ t (
360+ & mut map,
361+ "# Example" ,
362+ "<h2 id=\" example\" ><a class=\" doc-anchor\" href=\" #example\" >§</a>Example</h2>" ,
363+ ) ;
364+ t (
365+ & mut map,
366+ "# Panics" ,
367+ "<h2 id=\" panics\" ><a class=\" doc-anchor\" href=\" #panics\" >§</a>Panics</h2>" ,
368+ ) ;
369+ t (
370+ & mut map,
371+ "# Example" ,
372+ "<h2 id=\" example-1\" ><a class=\" doc-anchor\" href=\" #example-1\" >§</a>Example</h2>" ,
373+ ) ;
374+ t (
375+ & mut map,
376+ "# Search" ,
377+ "<h2 id=\" search-1\" ><a class=\" doc-anchor\" href=\" #search-1\" >§</a>Search</h2>" ,
378+ ) ;
379+ t (
380+ & mut map,
381+ "# Example" ,
382+ "<h2 id=\" example-2\" ><a class=\" doc-anchor\" href=\" #example-2\" >§</a>Example</h2>" ,
383+ ) ;
384+ t (
385+ & mut map,
386+ "# Panics" ,
387+ "<h2 id=\" panics-1\" ><a class=\" doc-anchor\" href=\" #panics-1\" >§</a>Panics</h2>" ,
388+ ) ;
360389}
361390
362391#[ test]
0 commit comments