feat(docs): added links to github changelog to migration page headers#3604
feat(docs): added links to github changelog to migration page headers#3604duvalale wants to merge 13 commits into
Conversation
✅ Deploy Preview for boosted ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
MaxLardenois
left a comment
There was a problem hiding this comment.
I think it'd be better if the changelog link was on a dedicated link or button below the title (or on its right for wider viewports)
Here the link is not easily visible and it lacks an accessible text.
1c99711 to
0563034
Compare
|
I updated the headers to add a dedicated link. |
MaxLardenois
left a comment
There was a problem hiding this comment.
Nice work!
I have some suggestion but nothing blocking so I will approve
| } | ||
|
|
||
| // A rehype plugin to reorder header anchor and version links | ||
| export const rehypeHeaderLinksOrder: Plugin<[], Root> = function () { |
There was a problem hiding this comment.
Maybe we could simplify this by using the option before on rehypeAutolinkHeadings
This way the anchor-link would always be first (before the actual heading text), this would be that less to do.
But it works as is, just an idea.
There was a problem hiding this comment.
I tried to keep the existing headers as is on purpose, but it is indeed simpler to move the anchor-link before the actual heading.
I removed the rehypeHeaderLinksOrder and updated the autolink conf.
There was a problem hiding this comment.
I kept the existing header as is on purpose, but if I am allowed to update it, it is indeed better to prepend the anchor link.
It's done, and the rehypeHeaderLinksOrder is removed.
There was a problem hiding this comment.
Sorry I was not clear: we should keep the end result as is (anchor-link after the heading text). But for this script I think it might be helpful if the anchor-link were always first, so that you only need to spilt the heading elements and reorder everytime, no need to find the anchor-link
There was a problem hiding this comment.
Done as you suggested.
However, this does not simplify as much as I thought the function since we also have to manage the component icon displayed on some headings.
d214b9e to
3a38f39
Compare
fcec38d to
8cd3170
Compare
There was a problem hiding this comment.
Pull request overview
Adds “Full changelog” links (with an external-link icon) to version headers in the Migration documentation, and adjusts the Markdown/HTML processing pipeline so heading anchors and generated IDs behave correctly with the new inline link content.
Changes:
- Introduces a
[[version-changelog-link]]marker and a remark plugin to inject a GitHub release link into version headings. - Updates rehype/markdown integration to change heading autolink behavior and reorder heading children.
- Adds an
external-linksymbol to each brand’s SVG sprite so the injected link can display an icon.
Reviewed changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| site/static/sosh/docs/[version]/assets/img/ouds-web-sprite.svg | Adds external-link symbol to sprite for Sosh docs. |
| site/static/orange/docs/[version]/assets/img/ouds-web-sprite.svg | Adds external-link symbol to sprite for Orange docs. |
| site/static/orange-compact/docs/[version]/assets/img/ouds-web-sprite.svg | Adds external-link symbol to sprite for Orange Compact docs. |
| site/src/libs/utils.ts | Adds helpers for generating the version changelog link + heading detection. |
| site/src/libs/toc.ts | Strips “Full changelog” from heading text when generating ToC entries. |
| site/src/libs/remark.ts | Adds remark plugin to inject version changelog link HTML into headings. |
| site/src/libs/rehype.ts | Adds rehype plugins for heading child ordering and heading-id adjustment. |
| site/src/libs/astro.ts | Wires new remark/rehype plugins into Astro markdown configuration and changes autolink behavior. |
| site/src/content/docs/getting-started/migration.mdx | Adds the [[version-changelog-link]] marker to version headings. |
|
There is two issues in the result :
|
82f872a to
cb08b0d
Compare
louismaximepiton
left a comment
There was a problem hiding this comment.
I'm fine with the changes, tbh I think we could go through the frontmatter instead of a remark thing since all the title h2 are changed on the page. However, it works like a charm so I'm fine with the changes, if you wanna merge as-is.
| } | ||
|
|
||
| export function getVersionLink(version: string): string { | ||
| return `<a class="link icon-link float-end p-none" href="https://github.com/Orange-OpenSource/Orange-Boosted-Bootstrap/releases/tag/${version}-ouds-web" target="_blank" rel="noopener"> |
There was a problem hiding this comment.
Not a big fan of using float-end, but can't figure out how to achieve the smae thing in a different way.
|
|
||
| for (const heading of headings) { | ||
| if (heading.text.includes('Full changelog')) { | ||
| heading.text = heading.text.replace(' Full changelog', '') |
There was a problem hiding this comment.
I think that we don't need the condition above to run the line.
| } | ||
|
|
||
| export function getHeadingSlug(str: string) { | ||
| return str.replace(/-------full-changelog---------------------/g, '') |
There was a problem hiding this comment.
I can't figure out why we have this specific string ?
There was a problem hiding this comment.
From what I understand, rehypeHeadingIds generates slug from the content of the whole node, which includes the "full changelog" link, and generates this string.
If I don't remove it, the generated slug when clicking on anchor or TOC is #vXYZ-------full-changelog---------------------, which is not pretty in the URL.
| } | ||
|
|
||
| // A rehype plugin to reorder header anchor link and header text | ||
| export const rehypeHeaderLinksOrder: Plugin<[], Root> = function () { |
There was a problem hiding this comment.
I quite don't unserstand why we do want them in this exact order, I think title -> Full changelog -> anchor is fine no ?
There was a problem hiding this comment.
If I don't reorder them, the DOM will not reflect the reading/display order, and keyboard navigation won't match what the user sees : We will see title -> anchor -> full changelog, and keyboard navigation order will be title -> full changelog -> anchor.
…ve reordering plugin
94e305b to
fea4901
Compare
Related issues
Closes #3457
Description
Updated migration page headers to add link redirecting to matching changelog.
Checklists
Progression (for Core Team only)
ouds/mainfollowing conventional commitLive previews