Skip to content

fix the automatic generation of anchors in the reference doc #2012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

jnavila
Copy link
Contributor

@jnavila jnavila commented May 29, 2025

The automatic generation of anchors in the reference documentation by copilot in #2007 was wrong.

What needs to be added is additional ids that can be used to link to the terms of definition lists. At the same time, the advertised anchor is change to reflect the new format.

The automatic generation of anchors in the reference documentation by
copilot in #2007 was wrong.

What needs to be added is additional ids that can be used to link to
the terms of definition lists. At the same time, the advertised anchor
is change to reflect the new format.

Signed-off-by: Jean-Noël Avila <[email protected]>
@To1ne
Copy link
Collaborator

To1ne commented Jun 3, 2025

Works like a charm:

Snippet from the resulting /docs/git-clone page:

<dl>
  <dt class="hdlist1" id="Documentation/git-clone.txt-code-lcode"><a id="Documentation/git-clone.txt--l" class="anchor" href="#Documentation/git-clone.txt--l"></a><code>-l</code> </dt>
  <dt class="hdlist1" id="Documentation/git-clone.txt-code--localcode"><a id="Documentation/git-clone.txt---local" class="anchor" href="#Documentation/git-clone.txt---local"></a><code>--local</code> </dt>
  <dd>
    <p>When the repository to clone from is on a local machine,
    <!-- ... -->

@To1ne
Copy link
Collaborator

To1ne commented Jun 3, 2025

Thanks @jnavila !

@To1ne To1ne self-requested a review June 3, 2025 09:20
Copy link
Collaborator

@To1ne To1ne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@To1ne To1ne merged commit dd89e01 into gh-pages Jun 3, 2025
1 check passed
@To1ne To1ne deleted the fix_refs_anchor_links branch June 3, 2025 09:23
Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Too late.

Comment on lines -490 to -493
clean_anchor = "<a class=\"anchor\" href=\"##{clean_anchor}\"></a> "
"<dt class=\"hdlist1\" id=\"#{anchor}\"><a id=\"#{clean_anchor}\" class=\"anchor\" href=\"##{clean_anchor}\"></a>#{$1} </dt>"
else
"<dt class=\"hdlist1\" id=\"#{anchor}\"><a class=\"anchor\" href=\"##{anchor}\"></a>#{$1} </dt>"
end

"<dt class=\"hdlist1\" id=\"#{anchor}\"> #{clean_anchor}<a class=\"anchor\" href=\"##{anchor}\"></a>#{$1} </dt>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we simply have done a s/href/id/ instead?

@dscho
Copy link
Member

dscho commented Jun 3, 2025

What about

clean_anchor = "<a class=\"anchor\" href=\"##{clean_anchor}\"></a> "
?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants