Skip to content

Fix section heading link fragments which start with a digit#11811

Open
ScatteredComet wants to merge 4 commits intogodotengine:masterfrom
ScatteredComet:correct-link-fragments
Open

Fix section heading link fragments which start with a digit#11811
ScatteredComet wants to merge 4 commits intogodotengine:masterfrom
ScatteredComet:correct-link-fragments

Conversation

@ScatteredComet
Copy link
Contributor

@ScatteredComet ScatteredComet commented Mar 3, 2026


  • Does using -, ., / within a custom anchor break them? If so then some of my changes will need amending [Edit: they do, and have been removed]
  • When the convention _doc_<page_slug>_<title_slug>: led to non-unique anchors (e.g. in upgrading_to_godot_4.6.rst & docs_changelog.rst where headings are used twice) I used _doc_<page_slug>_<section_slug>_<subsection_slug>:
  • I did not check if all pre-existing section anchors fit these 2 conventions
  • binary_serialization_api.rst headings contain lots of colons: what should we do? [Edit: they are fine as is]

I also think it would be a good idea to add something to the contributing docs and/or unit tests saying that you need to provide a custom anchor if you define a title which starts with a number, and define a convention.

Notes on this PR

I used ripgrep with the commands rg -U '^[0-9].*\n-' and rg -U '^[0-9].*\n~' to search for these, which corresponds to searching for [line with a number at the start] + [line break] + [~ or -].

I also saw a lot of page anchors which dont align to

The reference _doc_insert_your_title_here and the title should match.

from the "writing the manual" page, but I'll make another PR for that as its a large diff.

as per Calinou's suggestion

I very well may have missed some
@ScatteredComet ScatteredComet requested review from a team as code owners March 3, 2026 22:03
@ScatteredComet ScatteredComet changed the title Fix section headings which start with a digit Fix section heading link fragments which start with a digit Mar 3, 2026
@ScatteredComet
Copy link
Contributor Author

ScatteredComet commented Mar 3, 2026

From the CI, it looks like including those special characters break the links; I'll remove them. Would be nice to know exactly what characters are allowed though if we're going to define a convention.

@ScatteredComet ScatteredComet force-pushed the correct-link-fragments branch from 0eceb42 to da1b748 Compare March 3, 2026 22:22
@ScatteredComet
Copy link
Contributor Author

I tried to look for some specification for valid anchors but didn't manage to find anything, so I just changed all special characters to underscores.

@Calinou Calinou added bug content:website Issues related to adding website features and fixing bugs, whether on the front or back-end labels Mar 3, 2026
@Calinou
Copy link
Member

Calinou commented Mar 3, 2026

I also saw a lot of page anchors which dont align to

The reference _doc_insert_your_title_here and the title should match.

from the "writing the manual" page, but I'll make another PR for that as its a large diff.

Changing page anchors will break translations, so I would recommend against this.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
@ScatteredComet
Copy link
Contributor Author

binary_serialization_api.rst's heading links are actually fine as is e.g.

https://docs.godotengine.org/en/stable/tutorials/io/binary_serialization_api.html#float

so I don't think there's anything else that needs to be added to this PR

I missed come headings before
@ScatteredComet
Copy link
Contributor Author

ScatteredComet commented Mar 4, 2026

This is a different solution than the contributing docs used e.g. here

godotengine/godot-contributing-docs#75 (comment) suggests that this PR might not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug content:website Issues related to adding website features and fixing bugs, whether on the front or back-end

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect link fragments

2 participants