TypeScript-Handbook
TypeScript-Handbook copied to clipboard
Headers on website cannot be clicked for anchor links.
...the headers are no longer links. Since each page can be huge, it would be much easier if each header is a link so we can point user to the right section.
they all have anchors, they are just not link tags. e.g. http://www.typescriptlang.org/docs/handbook/basic-types.html#any takes you to the Any
section.
We should fix this though.
For the record, titles like this are prone to get my attention, but hard for maintainers to find later on. :smile:
For the record, titles like this are prone to get my attention, but hard for maintainers to find later on.
My suggestion is to keep header neutral, non-opinionated. :smile: https://github.com/unional/typescript-guidelines/blob/master/pages/markdown.md#headers
Maybe - a more non-opinionated title would have been "Headers on website cannot be clicked for anchor links."
Honestly, not a big deal. ¯_(ツ)_/¯
Ar...... I mean the headers in the handbook. Not this issue's title. :p
Gotcha. The reason we have opinionated titles is because, well, we're opinionated. :smile:
Something to keep in mind is that a new technology is always a lot easier for people to follow along when people are reassured that they're doing the right thing than one that gives you decision fatigue.
That said, the point on keeping anchors in tact is a good one. I would like us to try to avoid this going forward.
@mhegazy @sandersn If changing a header in a document, let's strongly consider adding compatible section anchors.
agreed.
It's been a little while-- it would be very handy to make the headers tags with href="#someanchor" so we can click and share links to help others learn TypeScript concepts.
It's been even a while longer - I looked for some way to change the site generation to allow this, but wasn't able to find anything.
As a stopgap, here's a userscript I'm using to add links locally.
// ==UserScript==
// @name TypeScript Docs Anchors
// @namespace https://gerritbirkeland.com/
// @version 0.1
// @description Add anchors to headers for easily linking to a specific part of a page.
// @author Gerrit0
// @match http://www.typescriptlang.org/docs/*
// @grant none
// ==/UserScript==
document.querySelectorAll('h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]').forEach(el => {
const a = document.createElement('a')
a.href = '#' + el.id
el.parentNode.replaceChild(a, el)
a.appendChild(el)
});
I'd be happy to write a PR for this 😀
However, I couldn't find where the code is to compile and deploy the static site. I checked the .travis.yml, package.json, etc. Any tips on where I can look for that code?
@DanielRosenwasser isn't there still a manual (closed-source?!) step to publishing the handbook to the web site?