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
update-docs: make anchors backwards-compatible again
Command options in Git's documentation are now being wrapped in HTML
tags like `<code>` for prettier formatting. Unfortunately, these tags
were being included in the generated anchor IDs, breaking links that
used to work. For example, an anchor for the
`--recurse-submodules[=<pathspec>]` option of the `clone` command would
now include 'code' in the anchor, causing existing deep links across the
web to fail to navigate to said option.
The documentation generation has been using these anchors for years and
many links using the old format (without HTML tags) are widely shared.
These links should continue to work, even as the document formatting
evolves to include more HTML.
This change modifies the anchor ID generation to strip HTML tags before
creating IDs, ensuring backward compatibility with existing references
while also supporting the new HTML-enhanced documentation format. Both
regular and localized documentation processing now handle HTML tags in
command options correctly.
These anchor IDs still include the `lt` and `gt` left-overs from the
pointy brackets that are encoded as `<`/`>` in HTML. This is
intentional because the existing deep links all over the web do include
those.
Technically, this here patch is not needed to fix the regression because
the preceding commit introduced code that is running on the client side
and automagically adjusts incorrect anchors in URLs when practical.
Having said that, the resulting anchors look a lot nicer, so let's do
this anyway, even if it is not strictly needed to address
#2002.
Reported-by: Toon Claes <[email protected]>
Helped-by: Jean-Noël Avila <[email protected]>
Co-authored-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
0 commit comments