You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Put in a best effort when encountering invalid anchors
The Git project is in the process of changing the formatting of the
manual pages. Unfortunately this leads to changed (read: backwards
incompatible) anchors.
For example, the following link used to work:
https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---recurse-submodulesltpathspecgt
Now it no longer jumps to the `--recurse-submodules` description. The
reason is that the anchor changed from:
#Documentation/git-clone.txt---recurse-submodulesltpathspecgt
to:
#Documentation/git-clone.txt-code--recurse-submodulesltpathspecgtcode
I was well on my way to change the code to simply strip out the `<code>`
and `</code>` text before generating the anchor in `update-docs.rb`, but
alas... it would break e.g. #Documentation/git-clone.txt-code-lcode,
which is a valid anchor and has been since forever.
Nevertheless, it would be nice if that (quite ugly) anchor was turned
into #Documentation/git-clone.txt-l instead.
Let's bite the bullet and add a small JavaScript snippet that detects
when the URL contains an anchor that is not actually to be found on the
current page, and then look for an existing anchor that is most similar
to that, then use that (if found).
This is not a perfect solution by any stretch of imagination, but it
should definitely help, and it makes a future changes in the way anchors
are generated a lot less controversial.
Fixes#2002
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
0 commit comments