5 ms·
One dependency: Anchor.js — Provides nice clickable/linkable anchors for Markdown content Almost 6K minified to do something that the browser can do natively?
by x3ro 7y ago
One dependency:
Anchor.js — Provides nice clickable/linkable anchors for Markdown content
Almost 6K minified to do something that the browser can do natively?... I know I've been out of frontend for almost three years but I'm still confused :D
- ImpressiveWebs 7y agoThe browser does it natively if you hand code it into every page and every sub heading. What the tool does is allow you to insert the script into any page and it will automatically create anchors for all the sub headings. This saves tons of time because you don’t have to do it manually (i.e. by inserting IDs in every H1, H2, etc.)
- x3ro 7y agoI mean sure, if you were writing the website by hand. But every markdown processor I've used is able to derive these from headlines. And everything you can do in JavaScript you can also do when generating the page in the first place if it's just a one time modifications of the page.
- biggestlou 7y agoMarkdown parsers can auto-generate IDs for headers but they don't create a nice icon next when you hover over the header. That's what Anchor.js is for. For an example, see this page: https://kubernetescommunitydays.org/organizing https://kubernetescommunitydays.org/organizing.
- afandian 7y agoThose auto-generated anchors remind me of LaTeX references. You have to write the anchor IDs in manually ... but when you re-word your heading you don't suddenly break all of your links to it.
- x3ro 7y agoI know these, but there's also CSS so I don't understand why this needs JS..
- biggestlou 7y agoIf you know of an all-CSS solution, I'm all ears