qiskit-documentation/docs/api/qiskit-addon-utils
Arnau Casau f09e7fb055
Add `/docs/` base path to all API docs links (#2973)
This PR adds the `/docs/` base path to all API docs links by modifying
the MDX conversion pipeline. It also updates all the ignores to include
the base path.

I recommend reviewing the first 5 commits separately as they implement
all the code changes. The rest of the commits have been generated by
running `npm run regen-apis`

To update the qiskit release notes I used the following script:

<details><summary>Script</summary>

```ts
import { globby } from "globby";
import { readFile, writeFile } from "fs/promises";

export async function updateBrokenLinks(filePath: string): Promise<void> {
  let markdown = (await readFile(filePath)).toString();

  var regex = new RegExp(`\\]\\(\\/((?!docs\\/)[^\\)]*)\\)`, "g");
  markdown = markdown.replaceAll(regex, `\]\(/docs/$1\)`);

  await writeFile(filePath, markdown);
}

async function main() {
  const globs = [
    "docs/api/qiskit/release-notes/**/*.{ipynb,mdx}",
  ];
  const allGuides = await globby(globs);
  for (const guide of allGuides) {
    await updateBrokenLinks(guide);
  }
}

main().then(() => process.exit());
```

</details>

The PR workarounds some checks in order to get green CI. All of the
checks will be updated to take into account the base path in
https://github.com/Qiskit/documentation/pull/2958
2025-04-17 14:59:41 +00:00
..
_package.json Generate `qiskit-addon-mpf` 0.3.0 & `qiskit-addon-utils` 0.1.1 (#2820) 2025-03-20 13:03:14 +00:00
_toc.json Add `/docs/` base path to all API docs links (#2973) 2025-04-17 14:59:41 +00:00
coloring.mdx Tweaks and fixes for new addons (#2270) 2024-11-11 15:28:43 +00:00
index.mdx Add versions to API metadata & autogenerate index page metadata (#2241) 2024-11-06 13:07:35 -05:00
problem-generators.mdx Add `/docs/` base path to all API docs links (#2973) 2025-04-17 14:59:41 +00:00
release-notes.mdx Generate `qiskit-addon-mpf` 0.3.0 & `qiskit-addon-utils` 0.1.1 (#2820) 2025-03-20 13:03:14 +00:00
slicing-transpiler-passes-collect-op-color.mdx Add `/docs/` base path to all API docs links (#2973) 2025-04-17 14:59:41 +00:00
slicing-transpiler-passes-collect-op-size.mdx Add `/docs/` base path to all API docs links (#2973) 2025-04-17 14:59:41 +00:00
slicing-transpiler-passes-collect-op-type.mdx Add `/docs/` base path to all API docs links (#2973) 2025-04-17 14:59:41 +00:00
slicing-transpiler-passes.mdx Add versions to API metadata & autogenerate index page metadata (#2241) 2024-11-06 13:07:35 -05:00
slicing.mdx Add `/docs/` base path to all API docs links (#2973) 2025-04-17 14:59:41 +00:00