Skip to content

doc/starlight: fix edit link for generated documents#21987

Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom
AnnsAnns:fixGenEdits
Jan 14, 2026
Merged

doc/starlight: fix edit link for generated documents#21987
miri64 merged 1 commit intoRIOT-OS:masterfrom
AnnsAnns:fixGenEdits

Conversation

@AnnsAnns
Copy link
Copy Markdown
Member

Contribution description

@miri64 noticed that the edit link was broken when the site was generated using one of the root markdown files, this should fix that.

Testing procedure

make doc-starlight and then click on the edit page link on e.g. Security

Issues/PRs references

@github-actions github-actions bot added the Area: doc Area: Documentation label Jan 13, 2026

if (starlightRoute.editUrl) {
let editUrl = starlightRoute.editUrl.toString();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change

(somehow, Github renders this suggestion weirdly. I mean: remove trailing whitespaces, please, i.e., keep the line empty)

const filename = editUrl.split(generatedPath)[1];
editUrl = editUrl.split(generatedPath)[0] + '/' + filename;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here too.

Suggested change

@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 13, 2026
Comment on lines +18 to +19
const filename = editUrl.split(generatedPath)[1];
editUrl = editUrl.split(generatedPath)[0] + '/' + filename;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As far as I understand this (very weird; why not just use '/' as a token and use the first and last element of the string) parsing step, this basically assumes that all files were generated from root. This invites potential footguns IMHO and also might lead to maybe unrelated files (something about boards/ e.g.) hogging the already quite crowded root path. I'd rather have a mapping somewhere, where the name of the generated file is mapped to the original source. It can be in this file, but maybe it makes sense to hook this directly into the generation somehow. This way, we would avoid risks of the generation and the edit links going potentially out of sync.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

"tech debt", the code was different before and I only later realized one issue with it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I looked into different solutions for this and if I'm being honest all of them felt really weird. Currently the only reason we'd ever have documentation on that exact /doc/guides/generated path is when they are root files and I don't foresee new files outside of root being added to that path

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As I said: I see it feasible to have some guide on a specific module or test, e.g., in a markdown file with that. But fine. I don't want to block the PR just because of that if you disagree.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nah I get what you mean, however, any good solution would probably require moving away from the current setup for generated sites we have (because it grew a bit too big for the initial "hacky" solution already) so all my attempts of adressing the feedback ended up with unsatisfactory solutions

@riot-ci
Copy link
Copy Markdown

riot-ci commented Jan 13, 2026

Murdock results

✔️ PASSED

7512d25 doc/starlight: fix edit link for generated documents

Success Failures Total Runtime
1 0 1 01m:21s

Artifacts

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

ACK. Tested with make doc-starlight.

@crasbe crasbe added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs labels Jan 14, 2026
@miri64 miri64 enabled auto-merge January 14, 2026 13:29
@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 14, 2026
@miri64 miri64 added this pull request to the merge queue Jan 14, 2026
Merged via the queue into RIOT-OS:master with commit adb09fc Jan 14, 2026
34 checks passed
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: doc Area: Documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants