#221·mdBook

Headers containing links result in invalid HTML; nested `a` tags

Author: ollie27Created Mar 5, 2017Updated Aug 16, 2026
LabelsA-HTMLA-RenderingC-bugA-Links
If a header contains a link like the following it will result in nested `a` tags which is [invalid](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a). ```markdown ## Header with [link](https://example.com). ``` This results in: ```html

Header with link.

``` A possible solution is to put the anchor at the start or end of the header rather than around the whole thing.