TypeScript-Handbook icon indicating copy to clipboard operation
TypeScript-Handbook copied to clipboard

Headers on website cannot be clicked for anchor links.

Open unional opened this issue 8 years ago • 11 comments

...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.

unional avatar Mar 29 '16 08:03 unional

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.

mhegazy avatar Mar 29 '16 16:03 mhegazy

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:

DanielRosenwasser avatar Mar 29 '16 17:03 DanielRosenwasser

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

unional avatar Mar 29 '16 17:03 unional

Maybe - a more non-opinionated title would have been "Headers on website cannot be clicked for anchor links."

Honestly, not a big deal. ¯_(ツ)_/¯

DanielRosenwasser avatar Mar 30 '16 07:03 DanielRosenwasser

Ar...... I mean the headers in the handbook. Not this issue's title. :p

unional avatar Mar 30 '16 07:03 unional

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.

DanielRosenwasser avatar Mar 30 '16 07:03 DanielRosenwasser

agreed.

mhegazy avatar Mar 30 '16 20:03 mhegazy

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.

RikkiGibson avatar Feb 23 '17 06:02 RikkiGibson

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)
});

Gerrit0 avatar Jan 19 '19 00:01 Gerrit0

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?

bgschiller avatar Jan 26 '19 00:01 bgschiller

@DanielRosenwasser isn't there still a manual (closed-source?!) step to publishing the handbook to the web site?

sandersn avatar Jan 26 '19 00:01 sandersn