the-programmers-hangout / website

🌳 TPH website
https://theprogrammershangout.com
MIT License
102 stars 67 forks source link

Replace or fix markdown auto headers #246

Closed veksen closed 4 years ago

veksen commented 4 years ago

This is necessary to keep the Table of contents in line with the headers. However, the anchors from the generated TOC (which are generated from frontmatter html/headings) do not match the auto headers from gatsby-remark-auto-headers.

gatsby-remark-auto-headers is a little problematic at the moment as it produces some invalid IDs (for example: "1. Get started" -> #1-get-started), and also doesn't match the way we generate anchors from headers, using Lodash kebabCase: https://github.com/the-programmers-hangout/website/blob/34047cc05cd5e7c5c4e5335e4b13e0c09ab0a5f9/src/utils/index.ts#L155

One solution would be to fork or use an internally modified version of the plugin.

See how lodash.com/gatsby does it: https://github.com/lodash/lodash.com/tree/gatsby/plugins/gatsby-source-lodash

veksen commented 4 years ago

blocks #252