Skip to content

Commit c3db274

Browse files
latest version should open by default (#3999)
Modified releasenotes.ts files so that latest version should open by default and updated the testcases #3980 --------- Co-authored-by: Eric Arellano <[email protected]>
1 parent 1cb9655 commit c3db274

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

docs/api/qiskit/release-notes/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ New features, bug fixes, and other changes in previous versions of Qiskit SDK.
99

1010
## Release notes by version
1111

12-
<details>
12+
<details open>
1313
<summary>v2</summary>
1414
- [v2.2](./2.2)
1515
- [v2.1](./2.1)

scripts/js/lib/api/releaseNotes.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test.describe("generateReleaseNotesIndex", () => {
4141
const result = generateReleaseNotesIndex(pkg);
4242
expect(result).toContain(`# My Quantum Project release notes`);
4343
expect(result).toContain(`
44-
<details>
44+
<details open>
4545
<summary>v2</summary>
4646
- [v2.0](./2.0)
4747
</details>

scripts/js/lib/api/releaseNotes.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@ New features, bug fixes, and other changes in previous versions of ${pkg.title}.
170170
const grouped = groupByMajorVersion(
171171
pkg.releaseNotesConfig.separatePagesVersions,
172172
);
173-
for (const [majorVersion, versionList] of grouped) {
174-
markdown += renderVersionGroup(majorVersion, versionList) + "\n\n";
175-
}
173+
[...grouped.entries()].forEach(([majorVersion, versionList], idx) => {
174+
markdown +=
175+
renderVersionGroup(majorVersion, versionList, {
176+
isLatestVersion: idx === 0,
177+
}) + "\n\n";
178+
});
176179
return markdown.trim();
177180
}
178181

@@ -272,12 +275,17 @@ export function groupByMajorVersion(versions: string[]): Map<string, string[]> {
272275
return sortedRecord;
273276
}
274277

275-
function renderVersionGroup(majorVersion: string, versions: string[]): string {
278+
function renderVersionGroup(
279+
majorVersion: string,
280+
versions: string[],
281+
kwargs: { isLatestVersion?: boolean } = {},
282+
): string {
276283
const items = versions
277284
.map((version) => `- [v${version}](./${version})`)
278285
.join("\n");
286+
const openAttr = kwargs.isLatestVersion ? " open" : "";
279287
return `
280-
<details>
288+
<details${openAttr}>
281289
<summary>v${majorVersion}</summary>
282290
${items}
283291
</details>

0 commit comments

Comments
 (0)