5 ms·
About the header slugs: I don't think the content of the header should be the anchor ID. Readers will link to it, the author will fix a spelling issue or whatev
by vortico 7y ago
About the header slugs: I don't think the content of the header should be the anchor ID. Readers will link to it, the author will fix a spelling issue or whatever, and the link will break and other readers will arrive at the top of the page when the browser doesn't find the old ID.
My solution that works with most Markdown variants is to use inline HTML to define an anchor directly before (or after) the header.
<a id="stuff"></a>
### Things about stuff
But of course this isn't much cleaner than just using inline HTML for the header itself.
<h3 id="stuff">Things about stuff</h3>
- swyx 7y agoas an author i'd say its rare to change headers, while its easy for the user to guess the right link if the id is broken. careful not to penalize the 99% usecase for a slightly better 1% usecase.
- chrismorgan 7y agoSome tools are now allowing you to manually specify the ID in this way: ### Things about stuff {#stuff} Hugo works that way by default, and I copied that syntax for Zola in https://github.com/getzola/zola/pull/685 https://github.com/getzola/zola/pull/685 last year.