From 543dffd3d2da4c53ad4b86a11b623d917c9a27c0 Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 13:21:48 +0800
Subject: [PATCH 01/11] feat(RevisionBlock): replace `dir="v"` to `vertical`
attribute
---
src/components/revision/RevisionBlock.astro | 10 ++----
src/content/docs/c/library/headers/index.mdx | 34 +++++++++----------
.../docs/c/library/strings/byte/memcpy.mdx | 8 ++---
.../docs/cpp/library/utilities/move.mdx | 6 ++--
.../docs/development/guide/doc-everything.mdx | 6 ++--
.../docs/development/guide/revision.mdx | 6 ++--
6 files changed, 33 insertions(+), 37 deletions(-)
diff --git a/src/components/revision/RevisionBlock.astro b/src/components/revision/RevisionBlock.astro
index d85400a1..8b1e0737 100644
--- a/src/components/revision/RevisionBlock.astro
+++ b/src/components/revision/RevisionBlock.astro
@@ -3,18 +3,14 @@ import RevisionTags from "./RevisionTags.astro";
import { autoRev } from ".";
import type { RevisionInfo } from "./types";
-type LayoutDirection = "h" | "v";
-
interface Props extends RevisionInfo {
noborder?: boolean;
- dir?: LayoutDirection;
+ vertical?: boolean;
}
const { since, until, noborder } = Astro.props;
-const dir = Astro.props.dir ?? "h";
-
-const horizontal = dir === "h";
-const vertical = dir === "v";
+const vertical = Astro.props.vertical ?? false;
+const horizontal = !vertical;
---
-
+
Complex number arithmetic
@@ -41,7 +41,7 @@ The interface of C standard library is defined by the following collection of he
-
+
Floating-point environment
@@ -53,14 +53,14 @@ The interface of C standard library is defined by the following collection of he
-
+
Format conversion of integer types
-
+
Alternative operator spellings
@@ -96,7 +96,7 @@ The interface of C standard library is defined by the following collection of he
slot="item"
noborder
since="C11"
- dir="v"
+ vertical
traits={[ { trait: "deprecated", since: "C23" } ]}
>
@@ -110,14 +110,14 @@ The interface of C standard library is defined by the following collection of he
-
+
Atomic operations
-
+
Macros to work with the byte and bit representations of types
@@ -128,7 +128,7 @@ The interface of C standard library is defined by the following collection of he
slot="item"
noborder
since="C99"
- dir="v"
+ vertical
traits={[ { trait: "deprecated", since: "C23" } ]}
>
@@ -137,7 +137,7 @@ The interface of C standard library is defined by the following collection of he
-
+
Macros for performing checked integer arithmetic
@@ -149,7 +149,7 @@ The interface of C standard library is defined by the following collection of he
-
+
Fixed-width integer types
@@ -166,7 +166,7 @@ The interface of C standard library is defined by the following collection of he
-
+
Text transcode
@@ -177,7 +177,7 @@ The interface of C standard library is defined by the following collection of he
slot="item"
noborder
since="C11"
- dir="v"
+ vertical
traits={[ { trait: "deprecated", since: "C23" } ]}
>
@@ -191,14 +191,14 @@ The interface of C standard library is defined by the following collection of he
-
+
Type-generic math (macros wrapping and )
-
+
Thread library
@@ -210,21 +210,21 @@ The interface of C standard library is defined by the following collection of he
-
+
UTF-16 and UTF-32 character utilities
-
+
Extended multibyte and wide character utilities
-
+
Functions to determine the type contained in wide character data
diff --git a/src/content/docs/c/library/strings/byte/memcpy.mdx b/src/content/docs/c/library/strings/byte/memcpy.mdx
index 15739244..894fd31c 100644
--- a/src/content/docs/c/library/strings/byte/memcpy.mdx
+++ b/src/content/docs/c/library/strings/byte/memcpy.mdx
@@ -161,7 +161,7 @@ dst = "\0\0\0\0\0yxyxy", r = 22
- `memccpy`
+ `memccpy`
copies one buffer to another, stopping after the specified delimiter
@@ -171,17 +171,17 @@ dst = "\0\0\0\0\0yxyxy", r = 22
`memmove`
- `memmove_s`
+ `memmove_s`
moves one buffer to another
- `wmemcpy`
+ `wmemcpy`
- `wmemcpy_s`
+ `wmemcpy_s`
copies a certain amount of wide characters between two non-overlapping arrays
diff --git a/src/content/docs/cpp/library/utilities/move.mdx b/src/content/docs/cpp/library/utilities/move.mdx
index 328c93e4..40755f21 100644
--- a/src/content/docs/cpp/library/utilities/move.mdx
+++ b/src/content/docs/cpp/library/utilities/move.mdx
@@ -133,21 +133,21 @@ The contents of the vector are {"Salut", "Salut"}
- `forward`
+ `forward`
forwards a function argument and use the type template argument to preserve its value category
- `move_if_noexcept`
+ `move_if_noexcept`
converts the argument to an xvalue if the move constructor does not throw
- `move`
+ `move`
moves a range of elements to a new location
diff --git a/src/content/docs/development/guide/doc-everything.mdx b/src/content/docs/development/guide/doc-everything.mdx
index 41f4d45c..d0a51697 100644
--- a/src/content/docs/development/guide/doc-everything.mdx
+++ b/src/content/docs/development/guide/doc-everything.mdx
@@ -201,7 +201,7 @@ import { RevisionBlock } from "@components/revision";
-
+
Complex number arithmetic
@@ -222,7 +222,7 @@ import { RevisionBlock } from "@components/revision";
-
+
Complex number arithmetic
@@ -236,7 +236,7 @@ import { RevisionBlock } from "@components/revision";
- We strongly recommend you to specify the `dir="v"` attribute on the `RevisionBlock` component inside a `Decl`. This would render to a more mobile-friendly output.
+ We strongly recommend you to specify the `vertical` attribute on the `RevisionBlock` component inside a `Decl`. This would render to a more mobile-friendly output.
diff --git a/src/content/docs/development/guide/revision.mdx b/src/content/docs/development/guide/revision.mdx
index 06e7e0e0..2fced990 100644
--- a/src/content/docs/development/guide/revision.mdx
+++ b/src/content/docs/development/guide/revision.mdx
@@ -138,11 +138,11 @@ Some more paragraphs.
### Vertical Layout
-By default, `RevisionBlock` has a left-to-right layout: the content sits at the left, and the revision information sits at the right. In addition, you can set the layout direction of `RevisionBlock` to top-to-bottom by setting the `dir` attribute to `v`:
+By default, `RevisionBlock` has a left-to-right layout: the content sits at the left, and the revision information sits at the right. In addition, you can set the layout direction of `RevisionBlock` to top-to-bottom by setting the `vertical` attribute to `true`:
```mdx {2}
Date: Tue, 2 Dec 2025 13:41:23 +0800
Subject: [PATCH 02/11] feat: add url to missing to represent missing resources
---
src/components/Missing.astro | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/components/Missing.astro b/src/components/Missing.astro
index 6eaeecf5..b58b2025 100644
--- a/src/components/Missing.astro
+++ b/src/components/Missing.astro
@@ -1,8 +1,11 @@
---
-
+interface Props {
+ // The expected url of the missing resource
+ url?: string;
+}
---
-
+
From f66aa5299561d57f7aa6addc9fef8457583c9098 Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 13:44:51 +0800
Subject: [PATCH 03/11] refactor: align page path under cpp/ with cppreference
---
src/content/docs/cpp/language/basic/_meta.yml | 1 -
.../docs/cpp/language/{basic/index.mdx => basic_concepts.mdx} | 2 +-
src/content/docs/cpp/language/{basic => }/main_function.mdx | 0
src/content/docs/index.mdx | 4 ++--
4 files changed, 3 insertions(+), 4 deletions(-)
delete mode 100644 src/content/docs/cpp/language/basic/_meta.yml
rename src/content/docs/cpp/language/{basic/index.mdx => basic_concepts.mdx} (91%)
rename src/content/docs/cpp/language/{basic => }/main_function.mdx (100%)
diff --git a/src/content/docs/cpp/language/basic/_meta.yml b/src/content/docs/cpp/language/basic/_meta.yml
deleted file mode 100644
index 9acf5771..00000000
--- a/src/content/docs/cpp/language/basic/_meta.yml
+++ /dev/null
@@ -1 +0,0 @@
-label: Basic concepts
diff --git a/src/content/docs/cpp/language/basic/index.mdx b/src/content/docs/cpp/language/basic_concepts.mdx
similarity index 91%
rename from src/content/docs/cpp/language/basic/index.mdx
rename to src/content/docs/cpp/language/basic_concepts.mdx
index dc54a3bd..49f89a07 100644
--- a/src/content/docs/cpp/language/basic/index.mdx
+++ b/src/content/docs/cpp/language/basic_concepts.mdx
@@ -12,7 +12,7 @@ import { Revision } from "@components/revision";
This section provides definitions for the specific terminology and the concepts used when describing the C++ programming language.
-A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
+A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
Certain words in a C++ program have special meaning, and these are known as keywords . Others can be used as identifiers . Comments are ignored during translation. C++ programs also contain literals , the values of characters inside them are determined by character sets and encodings . Certain characters in the program have to be represented with escape sequences .
diff --git a/src/content/docs/cpp/language/basic/main_function.mdx b/src/content/docs/cpp/language/main_function.mdx
similarity index 100%
rename from src/content/docs/cpp/language/basic/main_function.mdx
rename to src/content/docs/cpp/language/main_function.mdx
diff --git a/src/content/docs/index.mdx b/src/content/docs/index.mdx
index 2736c03c..c6294ab9 100644
--- a/src/content/docs/index.mdx
+++ b/src/content/docs/index.mdx
@@ -8,7 +8,7 @@ hero:
file: ../../assets/cpp-logo.svg
actions:
- text: Reference
- link: /cpp/language/basic
+ link: /cpp/language/basic_concepts
variant: primary
icon: right-arrow
- text: GitHub Repository
@@ -22,7 +22,7 @@ banner:
import { LinkCard, CardGrid } from '@astrojs/starlight/components';
-
+
From 7adeb35fa3ae4a0bdbd2ee6994b7428508d1f31d Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 14:10:21 +0800
Subject: [PATCH 04/11] refactor(Missing): remove url prop
---
src/components/Missing.astro | 6 +-----
src/content/docs/cpp/language/basic_concepts.mdx | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/components/Missing.astro b/src/components/Missing.astro
index b58b2025..cc8a93c1 100644
--- a/src/components/Missing.astro
+++ b/src/components/Missing.astro
@@ -1,11 +1,7 @@
---
-interface Props {
- // The expected url of the missing resource
- url?: string;
-}
---
-
+
diff --git a/src/content/docs/cpp/language/basic_concepts.mdx b/src/content/docs/cpp/language/basic_concepts.mdx
index 49f89a07..dc54a3bd 100644
--- a/src/content/docs/cpp/language/basic_concepts.mdx
+++ b/src/content/docs/cpp/language/basic_concepts.mdx
@@ -12,7 +12,7 @@ import { Revision } from "@components/revision";
This section provides definitions for the specific terminology and the concepts used when describing the C++ programming language.
-A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
+A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
Certain words in a C++ program have special meaning, and these are known as keywords . Others can be used as identifiers . Comments are ignored during translation. C++ programs also contain literals , the values of characters inside them are determined by character sets and encodings . Certain characters in the program have to be represented with escape sequences .
From 662601734af5f596c9a859386f8b0a7f15a28b5c Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 14:16:06 +0800
Subject: [PATCH 05/11] feat(DocLink): support absolute urls
---
src/lib/doc-index.ts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/lib/doc-index.ts b/src/lib/doc-index.ts
index 55158c0e..33291500 100644
--- a/src/lib/doc-index.ts
+++ b/src/lib/doc-index.ts
@@ -57,6 +57,12 @@ async function getOrBuildKeyIndex(): Promise> {
*/
export async function getLinkToKey(key: string): Promise {
const index = await getOrBuildKeyIndex();
+ if (key.startsWith("/")) {
+ if (Object.values(index).some(slug => `/${slug}/` === key || `/${slug}` === key))
+ return key;
+ else
+ return undefined;
+ }
const slug = index.get(key);
if (!slug) return undefined;
return `/${slug}/`;
From ca63d0cee798232dc98d5f65cc64b52d91feadca Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 14:26:23 +0800
Subject: [PATCH 06/11] refactor(DocLink): allow absolute path and src
---
src/components/DocLink.astro | 10 +++++-----
src/content/docs/cpp/language/basic_concepts.mdx | 2 +-
.../docs/development/guide/doc-everything.mdx | 12 +++++++++---
src/lib/doc-index.ts | 4 ++--
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/components/DocLink.astro b/src/components/DocLink.astro
index a4f697dd..a39e8551 100644
--- a/src/components/DocLink.astro
+++ b/src/components/DocLink.astro
@@ -2,11 +2,11 @@
import { getLinkToKey } from "../lib/doc-index";
interface Props {
- dest: string;
+ src: string;
}
-const { dest } = Astro.props;
-const rawLink = await getLinkToKey(dest);
+const { src } = Astro.props;
+const rawLink = await getLinkToKey(src);
const missing = rawLink === undefined;
const link = rawLink ?? "";
@@ -14,11 +14,11 @@ const link = rawLink ?? "";
{
missing ? (
-
+
) : (
-
+
)
diff --git a/src/content/docs/cpp/language/basic_concepts.mdx b/src/content/docs/cpp/language/basic_concepts.mdx
index dc54a3bd..b28c0f51 100644
--- a/src/content/docs/cpp/language/basic_concepts.mdx
+++ b/src/content/docs/cpp/language/basic_concepts.mdx
@@ -12,7 +12,7 @@ import { Revision } from "@components/revision";
This section provides definitions for the specific terminology and the concepts used when describing the C++ programming language.
-A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
+A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
Certain words in a C++ program have special meaning, and these are known as keywords . Others can be used as identifiers . Comments are ignored during translation. C++ programs also contain literals , the values of characters inside them are determined by character sets and encodings . Certain characters in the program have to be represented with escape sequences .
diff --git a/src/content/docs/development/guide/doc-everything.mdx b/src/content/docs/development/guide/doc-everything.mdx
index d0a51697..d6e7f8d5 100644
--- a/src/content/docs/development/guide/doc-everything.mdx
+++ b/src/content/docs/development/guide/doc-everything.mdx
@@ -290,18 +290,24 @@ cppdoc:
While a page can have multiple doc keys, each unique doc key can only be associated to at most one page.
-The `DocLink` component allows you to render an inline link to the page associated with the specified doc key.
+The `DocLink` component allows you to render an inline link to the page associated with the specified doc key. You can also specify the destination page by its absolute path.
```mdx
import DocLink from "@components/DocLink.astro";
Check out
-this page
+this page
+for more information about `std::move`.
+
+Check out
+this page
for more information about `std::move`.
```
- Check out this page for detailed information about `std::move`.
+ Check out this page for detailed information about `std::move`.
+
+ Check out this page for more information about `std::move`.
diff --git a/src/lib/doc-index.ts b/src/lib/doc-index.ts
index 33291500..fecf056d 100644
--- a/src/lib/doc-index.ts
+++ b/src/lib/doc-index.ts
@@ -57,8 +57,8 @@ async function getOrBuildKeyIndex(): Promise> {
*/
export async function getLinkToKey(key: string): Promise {
const index = await getOrBuildKeyIndex();
- if (key.startsWith("/")) {
- if (Object.values(index).some(slug => `/${slug}/` === key || `/${slug}` === key))
+ if (key?.startsWith("/")) {
+ if (index.values().some(slug => `/${slug}/` === key || `/${slug}` === key))
return key;
else
return undefined;
From 847b3bb5e176aaf561533663c35779178fd03f55 Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 14:45:46 +0800
Subject: [PATCH 07/11] refactor: move basic_concepts.mdx to basics.mdx
---
.../docs/cpp/language/{basic_concepts.mdx => basics.mdx} | 0
src/content/docs/index.mdx | 4 ++--
2 files changed, 2 insertions(+), 2 deletions(-)
rename src/content/docs/cpp/language/{basic_concepts.mdx => basics.mdx} (100%)
diff --git a/src/content/docs/cpp/language/basic_concepts.mdx b/src/content/docs/cpp/language/basics.mdx
similarity index 100%
rename from src/content/docs/cpp/language/basic_concepts.mdx
rename to src/content/docs/cpp/language/basics.mdx
diff --git a/src/content/docs/index.mdx b/src/content/docs/index.mdx
index c6294ab9..beaba508 100644
--- a/src/content/docs/index.mdx
+++ b/src/content/docs/index.mdx
@@ -8,7 +8,7 @@ hero:
file: ../../assets/cpp-logo.svg
actions:
- text: Reference
- link: /cpp/language/basic_concepts
+ link: /cpp/language/basics
variant: primary
icon: right-arrow
- text: GitHub Repository
@@ -22,7 +22,7 @@ banner:
import { LinkCard, CardGrid } from '@astrojs/starlight/components';
-
+
From 726b1eee28190b4cc02f12944667c00ab093785b Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 15:22:31 +0800
Subject: [PATCH 08/11] feat: add llm component docs
---
.../guide/component-docs-for-llm.mdx | 542 ++++++++++++++++++
1 file changed, 542 insertions(+)
create mode 100644 src/content/docs/development/guide/component-docs-for-llm.mdx
diff --git a/src/content/docs/development/guide/component-docs-for-llm.mdx b/src/content/docs/development/guide/component-docs-for-llm.mdx
new file mode 100644
index 00000000..b74da26a
--- /dev/null
+++ b/src/content/docs/development/guide/component-docs-for-llm.mdx
@@ -0,0 +1,542 @@
+---
+title: Component Documentation for LLM
+sidebar:
+ order: 4
+---
+
+This document provides comprehensive documentation for all custom components used in CppDoc. Each section includes a description, props, and usage examples.
+
+## Behavior
+
+The `Behavior` component gives highlight colors to its content, used for emphasizing keywords related to program behaviors.
+
+### Props
+
+- `kind` (required): One of `"well-def"`, `"impl-def"`, `"unspec"`, `"undef"`, `"ill-formed"`, `"ifndr"`.
+
+### Usage
+
+
+import Behavior from "@components/Behavior.astro";
+
+It is well-defined to do this.
+
+It is implementation-defined how this is achieved.
+
+It is unspecified which function argument will be evaluated first.
+
+The behavior is undefined to add two signed integers that overflows the result.
+
+It is ill-formed to use an undefined identifier.
+
+The program is ill-formed no diagnostics required if it violates the one-definition rule.
+
+## Declaration Documentation
+
+### DeclDoc
+
+The `DeclDoc` component gives brief introduction to a C/C++ declaration. It can contain multiple `Decl` components.
+
+#### Props
+
+- `autorevSince` (optional): The revision since which the declaration is available (e.g., `"C++11"`). Enables autorev.
+- `id` (optional): A numeric identifier to display as "Declaration #id".
+
+#### Slots
+
+- `decl` (named): One or more `Decl` components.
+- Default slot: The description text.
+
+#### Usage
+
+
+import { Decl, DeclDoc } from "@components/decl-doc";
+
+
+
+ ```cpp
+ int main() { /* body */ }
+ ```
+
+ A `main` function running independently of environment-provided arguments.
+
+
+Multiple declarations:
+
+
+
+
+ ```cpp
+ int main() { /* body */ }
+ ```
+
+
+ ```cpp
+ int main(int argc, char *argv[]) { /* body */ }
+ ```
+
+ A `main` function is the entry point of a program.
+
+
+With revision:
+
+
+import { RevisionBlock } from "@components/revision";
+
+
+
+
+ ```cpp
+ template
+ typename std::remove_reference::type&& move(T&& t) noexcept;
+ ```
+
+
+
+
+ ```cpp
+ template
+ constexpr std::remove_reference_t&& move(T&& t) noexcept;
+ ```
+
+
+ `std::move` is used to _indicate_ that an object `t` may be "moved from".
+
+
+
+### Decl
+
+The `Decl` component wraps a code block inside a `DeclDoc`. It has no props.
+
+#### Usage
+
+See above.
+
+## Description List
+
+### DescList
+
+The `DescList` component is a general component for displaying a list of items and their descriptions.
+
+#### Props
+
+None.
+
+#### Slots
+
+- Default slot: One or more `Desc` components.
+
+#### Usage
+
+
+import { DescList, Desc } from "@components/desc-list";
+import { CHeader } from "@components/header";
+
+
+
+
+ Conditionally compiled macro that compares its argument to zero
+
+
+
+ Functions to determine the type contained in character data
+
+
+
+### Desc
+
+The `Desc` component represents a single item in a description list.
+
+#### Props
+
+- `autorevSince` (optional): Enables autorev for this item.
+- `kind` (optional): A string displayed in parentheses after the description.
+
+#### Slots
+
+- `item` (named): The item being described (e.g., a header link).
+- Default slot: The description text.
+
+#### Usage
+
+
+
+
+ Conditionally compiled macro that compares its argument to zero
+
+
+
+With revision:
+
+
+
+
+
+
+ Complex number arithmetic
+
+
+
+### DescItem
+
+Internal component used by `Desc`. Not typically used directly.
+
+## Parameters
+
+### ParamDocList
+
+The `ParamDocList` component displays a list of function or template parameters.
+
+#### Props
+
+None.
+
+#### Slots
+
+- Default slot: One or more `ParamDoc` components.
+
+#### Usage
+
+
+import { ParamDocList, ParamDoc } from "@components/param-doc";
+
+
+
+ Non-negative value representing the number of arguments passed to the program.
+
+
+ Pointer to the first element of an array of `argc + 1` pointers.
+
+
+
+
+### ParamDoc
+
+The `ParamDoc` component documents a single parameter.
+
+#### Props
+
+- `name` (required): The parameter name.
+
+#### Slots
+
+- Default slot: The parameter description.
+
+#### Usage
+
+See above.
+
+## Links
+
+### DocLink
+
+The `DocLink` component renders an inline link to a page associated with a doc key or absolute path.
+
+#### Props
+
+- `src` (required): The doc key (e.g., `"cpp.library.utilities.move"`) or absolute path (e.g., `"/cpp/library/utilities/move"`).
+
+#### Slots
+
+- Default slot: The link text.
+
+#### Usage
+
+
+import DocLink from "@components/DocLink.astro";
+
+Check out this page for more information.
+
+Check out this page for more information.
+
+
+If the doc key does not exist, the component renders as plain text with missing styling.
+
+### CHeader
+
+The `CHeader` component renders an inline link to a C standard library header.
+
+#### Props
+
+- `name` (required): The header name without the `.h` suffix (e.g., `"stdio"`).
+- `displayName` (optional): Custom display text.
+- `nolink` (optional): If `true`, renders as plain text without a link.
+
+#### Usage
+
+
+ is a C standard library header.
+
+
+### CppHeader
+
+The `CppHeader` component renders an inline link to a C++ standard library header.
+
+#### Props
+
+Same as `CHeader`.
+
+#### Usage
+
+
+import { CppHeader } from "@components/header";
+
+ is a C++ standard library header.
+
+
+### Header
+
+Base component for `CHeader` and `CppHeader`. Not used directly.
+
+## Feature Test Macros
+
+### FeatureTestMacro
+
+The `FeatureTestMacro` component renders a box that shows information about a feature test macro.
+
+#### Props
+
+- `name` (required): The macro name (e.g., `"__cpp_consteval"`).
+
+#### Slots
+
+- Default slot: One or more `FeatureTestMacroValue` components.
+
+#### Usage
+
+
+import { FeatureTestMacro, FeatureTestMacroValue } from "@components/feature-test-macro";
+
+
+
+ Immediate functions
+
+
+ Making `consteval` propagate up
+
+
+
+
+### FeatureTestMacroValue
+
+The `FeatureTestMacroValue` component represents a single value of a feature test macro.
+
+#### Props
+
+- `value` (required): The macro value (e.g., `"201811L"`).
+- `since` (required): The revision since which this value is defined (e.g., `"C++20"`).
+
+#### Slots
+
+- Default slot: The feature description.
+
+#### Usage
+
+See above.
+
+## Defect Reports
+
+### DRList
+
+The `DRList` component shows a list of defect reports.
+
+#### Props
+
+None.
+
+#### Slots
+
+- Default slot: One or more `DR` components.
+
+#### Usage
+
+
+import { DR, DRList } from "@components/defect-report";
+
+
+
+
+ supported parameter names of `main` were overly restricted
+
+
+ all valid parameter names are supported
+
+
+
+
+
+### DR
+
+The `DR` component renders a single defect report.
+
+#### Props
+
+- `kind` (required): Either `"cwg"` (Core Working Group) or `"lwg"` (Library Working Group).
+- `id` (required): The defect report number.
+- `std` (required): The standard revision to which the defect applies (e.g., `"C++98"`).
+
+#### Slots
+
+- `behavior-published` (named): Description of the behavior as published.
+- `correct-behavior` (named): Description of the correct behavior.
+
+#### Usage
+
+See above.
+
+## Missing Content
+
+### Missing
+
+The `Missing` component marks content that is still missing.
+
+#### Props
+
+None.
+
+#### Slots
+
+- Default slot: The text to mark as missing.
+
+#### Usage
+
+
+import Missing from "@components/Missing.astro";
+
+See this page for more information.
+
+
+## Revision Components
+
+### Revision
+
+The `Revision` component renders an inline span with revision-specific content.
+
+#### Props
+
+- `since` (optional): The revision since which the content applies.
+- `until` (optional): The revision until which the content applies.
+- `removed` (optional): Alternative to `until`, indicates removal revision.
+- `traits` (optional): Array of `{ trait: string, since: CxxRevision }` for traits like "deprecated".
+
+#### Slots
+
+- Default slot: The revision-specific content.
+
+#### Usage
+
+
+import { Revision } from "@components/revision";
+
+Some words here. This is introduced in C++20. Some more words here.
+
+This is removed in C++20.
+
+This applies from C++11 to C++17.
+
+
+ This is introduced in C++11 and deprecated since C++17.
+
+
+
+### RevisionBlock
+
+The `RevisionBlock` component renders a block-level container with revision-specific content.
+
+#### Props
+
+- `since`, `until`, `removed`, `traits`: Same as `Revision`.
+- `noborder` (optional): If `true`, removes the border.
+- `vertical` (optional): If `true`, uses vertical layout.
+
+#### Slots
+
+- Default slot: The content.
+
+#### Usage
+
+
+ This paragraph applies from C++11 to C++17.
+
+
+
+ This paragraph is introduced in C++11, deprecated in C++20.
+
+
+
+### RevisionSelector
+
+The `RevisionSelector` component renders a dropdown for selecting a revision.
+
+#### Props
+
+- `revisions` (required): Array of `CxxRevision` strings.
+
+#### Usage
+
+Typically used automatically by the TableOfContents component.
+
+### RevisionTags
+
+Internal component used by `Revision` and `RevisionBlock`. Not used directly.
+
+## AutoCollapse
+
+The `AutoCollapse` component automatically collapses content that exceeds a maximum height, with an expand button.
+
+#### Props
+
+- `maxHeight` (optional): Maximum height in pixels before collapsing (default: 200).
+
+#### Slots
+
+- Default slot: The content to collapse.
+
+#### Usage
+
+
+import AutoCollapse from "@components/AutoCollapse.astro";
+
+
+ Long content here...
+
+
+
+## FlexTable
+
+The `FlexTable` component creates a flexible table layout using CSS flexbox.
+
+#### Props
+
+None.
+
+#### Slots
+
+- Default slot: The table cells.
+
+#### Usage
+
+
+import FlexTable from "@components/FlexTable.astro";
+
+
+ Cell 1
+ Cell 2
+ Cell 3
+
+
+
+## WG21PaperLink
+
+The `WG21PaperLink` component renders a link to a WG21 paper.
+
+#### Props
+
+- `paper` (required): The paper identifier (e.g., `"P1234R0"`).
+
+#### Usage
+
+
+import WG21PaperLink from "@components/WG21PaperLink.astro";
+
+See for details.
From fbad7287337f3e4a75ec734c9835025bac9f7631 Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 16:17:09 +0800
Subject: [PATCH 09/11] refactor: fix links and path for some pages
---
src/components/index.ts | 18 ++++++++++++
.../c/{library/headers => header}/index.mdx | 0
src/content/docs/c/language/basic/_meta.yml | 1 -
src/content/docs/c/language/basic/index.mdx | 22 --------------
.../docs/c/language/basic_concepts.mdx | 29 +++++++++++++++++++
src/content/docs/c/library/headers/_meta.yml | 1 -
src/content/docs/cpp/language/basics.mdx | 25 +++++++++-------
7 files changed, 62 insertions(+), 34 deletions(-)
create mode 100644 src/components/index.ts
rename src/content/docs/c/{library/headers => header}/index.mdx (100%)
delete mode 100644 src/content/docs/c/language/basic/_meta.yml
delete mode 100644 src/content/docs/c/language/basic/index.mdx
create mode 100644 src/content/docs/c/language/basic_concepts.mdx
delete mode 100644 src/content/docs/c/library/headers/_meta.yml
diff --git a/src/components/index.ts b/src/components/index.ts
new file mode 100644
index 00000000..52d3e1ae
--- /dev/null
+++ b/src/components/index.ts
@@ -0,0 +1,18 @@
+import Behavior from "@components/Behavior.astro";
+import { Decl, DeclDoc } from "@components/decl-doc";
+import { DescList, Desc } from "@components/desc-list";
+import { ParamDocList, ParamDoc } from "@components/param-doc";
+import DocLink from "@components/DocLink.astro";
+import { CHeader, CppHeader } from "@components/header";
+import { FeatureTestMacro, FeatureTestMacroValue } from "@components/feature-test-macro";
+import { DR, DRList } from "@components/defect-report";
+import { Revision, RevisionBlock } from "@components/revision";
+import AutoCollapse from "@components/AutoCollapse.astro";
+import FlexTable from "@components/FlexTable.astro";
+import WG21PaperLink from "@components/WG21PaperLink.astro";
+
+export {
+ Behavior, Decl, DeclDoc, DescList, Desc, ParamDocList, ParamDoc, DocLink,
+ CHeader, CppHeader, FeatureTestMacro, FeatureTestMacroValue, DR, DRList,
+ Revision, RevisionBlock, AutoCollapse, FlexTable, WG21PaperLink
+};
\ No newline at end of file
diff --git a/src/content/docs/c/library/headers/index.mdx b/src/content/docs/c/header/index.mdx
similarity index 100%
rename from src/content/docs/c/library/headers/index.mdx
rename to src/content/docs/c/header/index.mdx
diff --git a/src/content/docs/c/language/basic/_meta.yml b/src/content/docs/c/language/basic/_meta.yml
deleted file mode 100644
index 9acf5771..00000000
--- a/src/content/docs/c/language/basic/_meta.yml
+++ /dev/null
@@ -1 +0,0 @@
-label: Basic concepts
diff --git a/src/content/docs/c/language/basic/index.mdx b/src/content/docs/c/language/basic/index.mdx
deleted file mode 100644
index 8ac52761..00000000
--- a/src/content/docs/c/language/basic/index.mdx
+++ /dev/null
@@ -1,22 +0,0 @@
----
-title: Overview
-sidebar:
- order: 1
-cppdoc:
- keys: ["c.lang.basic"]
----
-
-import Behavior from "@components/Behavior.astro";
-import Missing from "@components/Missing.astro";
-
-This section provides definitions for the specific terminology and the concepts used when describing the C programming language.
-
-A C program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the OS calls its main function (unless it is itself the OS or another _freestanding_ program, in which case the entry point is implementation-defined ).
-
-Certain words in a C program have special meaning, they are keywords . Others can be used as identifiers , which may be used to identify objects , functions , struct , union , or enumeration tags, their members, typedef names, labels , or macros .
-
-Each identifier (other than macro) is only valid within a part of the program called its scope and belongs to one of four kinds of name spaces . Some identifiers have linkage which makes them refer to the same entities when they appear in different scopes or translation units.
-
-Definitions of functions include sequences of statements and declarations , some of which include expressions , which specify the computations to be performed by the program.
-
-Declarations and expressions create, destroy, access, and manipulate objects . Each object , function , and expression in C is associated with a type .
diff --git a/src/content/docs/c/language/basic_concepts.mdx b/src/content/docs/c/language/basic_concepts.mdx
new file mode 100644
index 00000000..30f33fdf
--- /dev/null
+++ b/src/content/docs/c/language/basic_concepts.mdx
@@ -0,0 +1,29 @@
+---
+title: Overview
+sidebar:
+ order: 1
+cppdoc:
+ keys: ["c.lang.basic"]
+---
+
+import DocLink from "@components/DocLink.astro";
+
+# Basic concepts
+
+This section provides definitions for the specific terminology and the concepts used when describing the C programming language.
+
+A C program is a sequence of text files (typically header and source files) that coimport DocLink from "@components/DocLink.astro";
+
+# Basic concepts
+
+This section provides definitions for the specific terminology and the concepts used when describing the C programming language.
+
+A C program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the OS calls its main function (unless it is itself the OS or another *freestanding* program, in which case the entry point is implementation-defined).
+
+Certain words in a C program have special meaning, they are keywords . Others can be used as identifiers , which may be used to identify objects , functions , struct , union , or enumeration tags, their members, typedef names, labels , or macros .
+
+Each identifier (other than macro) is only valid within a part of the program called its scope and belongs to one of four kinds of name spaces . Some identifiers have linkage which makes them refer to the same entities when they appear in different scopes or translation units.
+
+Definitions of functions include sequences of statements and declarations , some of which include expressions , which specify the computations to be performed by the program.
+
+Declarations and expressions create, destroy, access, and manipulate objects . Each object , function , and expression in C is associated with a type .
diff --git a/src/content/docs/c/library/headers/_meta.yml b/src/content/docs/c/library/headers/_meta.yml
deleted file mode 100644
index fa45e3a1..00000000
--- a/src/content/docs/c/library/headers/_meta.yml
+++ /dev/null
@@ -1 +0,0 @@
-label: C Standard Library headers
diff --git a/src/content/docs/cpp/language/basics.mdx b/src/content/docs/cpp/language/basics.mdx
index b28c0f51..0056ea08 100644
--- a/src/content/docs/cpp/language/basics.mdx
+++ b/src/content/docs/cpp/language/basics.mdx
@@ -6,24 +6,29 @@ cppdoc:
keys: ["cpp.lang.basic"]
---
-import Missing from "@components/Missing.astro";
-import DocLink from "@components/DocLink.astro";
import { Revision } from "@components/revision";
+import DocLink from "@components/DocLink.astro";
+
+# Basic concepts
This section provides definitions for the specific terminology and the concepts used when describing the C++ programming language.
-A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
+A C++ program is a sequence of text files (typically header and source files) that contain declarations . They undergo translation to become an executable program, which is executed when the C++ implementation calls its main function .
+
+Certain words in a C++ program have special meaning, and these are known as keywords . Others can be used as identifiers . Comments are ignored during translation. C++ programs also contain literals , the values of characters inside them are determined by character sets and encodings . Certain characters in the program have to be represented with escape sequences .
+
+The *entities* of a C++ program are values, objects , references , structured bindings , result bindings , functions , enumerators , types , class members, templates , template specializations , packs , and namespaces . Preprocessor macros are not C++ entities.
-Certain words in a C++ program have special meaning, and these are known as keywords . Others can be used as identifiers . Comments are ignored during translation. C++ programs also contain literals , the values of characters inside them are determined by character sets and encodings . Certain characters in the program have to be represented with escape sequences .
+Declarations may introduce entities, associate them with names and define their properties. The declarations that define all properties required to use an entity are definitions . A program must contain only one definition of any non-inline function or variable that is odr-used .
-The _entities_ of a C++ program are values, objects , references , structured bindings , result bindings , functions , enumerators , types , class members, templates , template specializations , packs , and namespaces . Preprocessor macros are not C++ entities.
+Definitions of functions usually include sequences of statements , some of which include expressions , which specify the computations to be performed by the program.
-Declarations may introduce entities, associate them with names and define their properties. The declarations that define all properties required to use an entity are definitions . A program must contain only one definition of any non-inline function or variable that is odr-used .
+Names encountered in a program are associated with the declarations that introduced them using name lookup . Each name is only valid within a part of the program called its scope . Some names have linkage which makes them refer to the same entities when they appear in different scopes or translation units.
-Definitions of functions usually include sequences of statements , some of which include expressions , which specify the computations to be performed by the program.
+Each object, reference, function, expression in C++ is associated with a type , which may be fundamental , compound, or user-defined , complete or incomplete , etc.
-Names encountered in a program are associated with the declarations that introduced them using name lookup . Each name is only valid within a part of the program called its scope . Some names have linkage which makes them refer to the same entities when they appear in different scopes or translation units.
+Declared objects and declared references that are not non-static data members are *variables *.
-Each object, reference, function, expression in C++ is associated with a type , which may be fundamental , compound, or user-defined , complete or incomplete , etc.
+## See also
-Declared objects and declared references that are not non-static data members are _variables_.
+C documentation for Basic concepts
\ No newline at end of file
From 0f658e41fb6de0c0380f909d22698872586b1728 Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 16:48:44 +0800
Subject: [PATCH 10/11] ci: impl migrate
---
.github/workflows/migrate.yml | 49 +++
migrate/PROMPT.md | 18 +
migrate/migrate-bot.js | 238 ++++++++++++
package-lock.json | 704 ++++++++++++++++++++++++++++++++++
package.json | 7 +-
5 files changed, 1014 insertions(+), 2 deletions(-)
create mode 100644 .github/workflows/migrate.yml
create mode 100644 migrate/PROMPT.md
create mode 100644 migrate/migrate-bot.js
diff --git a/.github/workflows/migrate.yml b/.github/workflows/migrate.yml
new file mode 100644
index 00000000..116b023c
--- /dev/null
+++ b/.github/workflows/migrate.yml
@@ -0,0 +1,49 @@
+name: Migrate cppreference pages
+
+on:
+ issues:
+ types:
+ - opened
+ - labeled
+ workflow_dispatch:
+ inputs:
+ issue_number:
+ description: 'Specific issue number to process (optional)'
+ required: false
+ type: string
+
+jobs:
+ migrate:
+ runs-on: ubuntu-latest
+ if: |
+ github.event_name == 'workflow_dispatch' ||
+ (github.event_name == 'issues' &&
+ (github.event.action == 'opened' || github.event.action == 'labeled') &&
+ contains(github.event.issue.labels.*.name, 'migrate-cppref-page'))
+ permissions:
+ contents: write
+ issues: write
+ pull-requests: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v6
+ with:
+ node-version: "22"
+ cache: "npm"
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Run migration bot
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
+ GITHUB_REPOSITORY: ${{ github.repository }}
+ GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
+ run: npm run migrate
\ No newline at end of file
diff --git a/migrate/PROMPT.md b/migrate/PROMPT.md
new file mode 100644
index 00000000..f9dd0fb5
--- /dev/null
+++ b/migrate/PROMPT.md
@@ -0,0 +1,18 @@
+You are a professional C++ documentation writer. You are now migrating cppreference.com documentation from HTML format to MDX format. During this process, you must adhere to the following rules:
+1. Only migrate the format, ensuring that the text of the migrated result is **exactly the same** as the original. Of course, you don't need to process text that was originally invisible.
+2. When using the pre-provided component library, import and only import the component you used. Do not try to write your own component. Do not try to write your own component. Do not try to write your own component. DO NOT USE NORMAL HTML ELEMENTS. Replace them with our MDX component.
+3. For links, take the URL part, remove `/w/` and the latter part `.html`, and then wrap it with `DocLink`. For example:
+If the current path is: `/w/cpp/language/basics.html`
+Link: `declarations `
+You should, based on the current link, change it to: `declarations `
+4. Currently available components:
+```mdx
+{{LLM_DOCS}}
+```
+
+## Note: The above content is all part of the component library examples. Do not confuse it with the actual content that needs to be migrated.
+
+The original content will be provided in the following format:
+// URL: Original page link
+Original page content
+Please proceed with the migration.
diff --git a/migrate/migrate-bot.js b/migrate/migrate-bot.js
new file mode 100644
index 00000000..b19ed02b
--- /dev/null
+++ b/migrate/migrate-bot.js
@@ -0,0 +1,238 @@
+#!/usr/bin/env node
+
+import { Octokit } from "@octokit/rest";
+import { JSDOM } from "jsdom";
+import fs, { readFile } from "fs/promises";
+import path from "path";
+import { fileURLToPath } from "url";
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
+const OPENROUTER_API_KEY = process.env.OPENROUTER_API_KEY;
+const REPO_OWNER = process.env.GITHUB_REPOSITORY_OWNER || "owner";
+const REPO_NAME = process.env.GITHUB_REPOSITORY?.split("/")[1] || "cppdoc";
+const LABEL = "migrate-cppref-page";
+
+if (!GITHUB_TOKEN) {
+ console.error("Missing GITHUB_TOKEN");
+ process.exit(1);
+}
+if (!OPENROUTER_API_KEY) {
+ console.error("Missing OPENROUTER_API_KEY");
+ process.exit(1);
+}
+
+const octokit = new Octokit({ auth: GITHUB_TOKEN });
+
+function extractLink(title) {
+ const urlRegex = /https?:\/\/en\.cppreference\.com\/w\/[^\s]+/g;
+ const match = title.match(urlRegex);
+ return match ? match[0] : null;
+}
+
+function hasPRReference(title) {
+ return /\[#\d+\]/.test(title);
+}
+
+async function fetchPageContent(url) {
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(`Failed to fetch ${url}: ${response.status}`);
+ }
+ const html = await response.text();
+ const dom = new JSDOM(html);
+ const contentElement = dom.window.document.querySelector("#mw-content-text");
+ const headingElement = dom.window.document.querySelector("#firstHeading");
+ if (!contentElement) {
+ throw new Error("Could not find #mw-content-text");
+ }
+ return {
+ html: contentElement.innerHTML,
+ title: headingElement?.textContent?.trim() || "",
+ url,
+ };
+}
+
+async function convertToMDX(html, title, url) {
+ const prompt = await readFile(__dirname + "/PROMPT.md", "utf8")
+ .replace("{{LLM_DOCS}}", await readFile(__dirname + "/../src/content/docs/development/guide/component-docs-for-llm.mdx", "utf8"));
+
+ const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${OPENROUTER_API_KEY}`,
+ "Content-Type": "application/json",
+ "HTTP-Referer": "https://github.com/cppdoc/cppdoc",
+ "X-Title": "CppDoc Migration Bot",
+ },
+ body: JSON.stringify({
+ model: "deepseek/deepseek-v3.2",
+ messages: [
+ { role: "system", content: prompt },
+ { role: "user", content:
+`
+// Convert the following HTML content from cppreference.com into MDX format suitable for CppDoc.
+// Title: ${title}
+// URL: ${url}
+// HTML Content:
+${html}
+`
+ }
+ ],
+ }),
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(`OpenRouter API error: ${error}`);
+ }
+
+ const data = await response.json();
+ return data.choices[0].message.content.trim();
+}
+
+function getLocalPath(url) {
+ // https://en.cppreference.com/w/cpp/comments.html -> src/content/docs/cpp/comments.mdx
+ const match = url.match(/https?:\/\/en\.cppreference\.com\/w\/(.+)\.html$/);
+ if (!match) {
+ throw new Error(`无法从URL解析路径: ${url}`);
+ }
+ const relative = match[1]; // "cpp/comments"
+ return path.join(__dirname, "..", "src", "content", "docs", `${relative}.mdx`);
+}
+
+async function writeMDXFile(filePath, content, title) {
+ const dir = path.dirname(filePath);
+ await fs.mkdir(dir, { recursive: true });
+ const frontmatter = `---
+title: ${title}
+description: Auto‑generated from cppreference
+---\n\n`;
+ await fs.writeFile(filePath, frontmatter + content, "utf8");
+ console.log(`写入 ${filePath}`);
+}
+
+async function createPullRequest(issue, filePath, url) {
+ const branchName = `migrate/${issue.number}-${Date.now().toString(36)}`;
+ const commitMessage = `Migrate ${url}`;
+ const prTitle = `[#${issue.number}] Migrate ${url}`;
+ const prBody = `自动迁移自 ${url}\n\nclose #${issue.number}`;
+
+ const { execSync } = await import("child_process");
+ try {
+ execSync(`git config user.name "github-actions[bot]"`);
+ execSync(`git config user.email "github-actions[bot]@users.noreply.github.com"`);
+ execSync(`git checkout -b ${branchName}`);
+ execSync(`git add "${filePath}"`);
+ execSync(`git commit -m "${commitMessage}"`);
+ execSync(`git push origin ${branchName}`);
+ } catch (error) {
+ console.error("Git操作失败:", error.message);
+ throw error;
+ }
+
+ const { data: pr } = await octokit.pulls.create({
+ owner: REPO_OWNER,
+ repo: REPO_NAME,
+ title: prTitle,
+ body: prBody,
+ head: branchName,
+ base: "main",
+ });
+
+ console.log(`创建PR #${pr.number}`);
+ return pr.number;
+}
+
+async function updateIssue(issue, prNumber, error = null) {
+ const newTitle = `[#${prNumber}] ${issue.title.replace(/\[#\d+\]\s*/, "")}`;
+ await octokit.issues.update({
+ owner: REPO_OWNER,
+ repo: REPO_NAME,
+ issue_number: issue.number,
+ title: newTitle,
+ });
+
+ if (error) {
+ await octokit.issues.createComment({
+ owner: REPO_OWNER,
+ repo: REPO_NAME,
+ issue_number: issue.number,
+ body: `迁移失败: ${error.message}\n\n已关闭issue。`,
+ });
+ await octokit.issues.update({
+ owner: REPO_OWNER,
+ repo: REPO_NAME,
+ issue_number: issue.number,
+ state: "closed",
+ });
+ } else {
+ await octokit.issues.createComment({
+ owner: REPO_OWNER,
+ repo: REPO_NAME,
+ issue_number: issue.number,
+ body: `迁移完成!已创建PR [#${prNumber}].`,
+ });
+ }
+}
+
+async function main() {
+ console.log("获取带有标签", LABEL, "的issue...");
+ const { data: issues } = await octokit.issues.listForRepo({
+ owner: REPO_OWNER,
+ repo: REPO_NAME,
+ labels: LABEL,
+ state: "open",
+ per_page: 50,
+ });
+
+ console.log(`找到 ${issues.length} 个issue`);
+
+ for (const issue of issues) {
+ console.log(`处理issue #${issue.number}: ${issue.title}`);
+ try {
+ if (hasPRReference(issue.title)) {
+ continue;
+ }
+
+ const url = extractLink(issue.title);
+ if (!url) {
+ throw new Error("标题中未找到有效的cppreference链接");
+ }
+
+ // 获取页面内容
+ console.log(` 获取 ${url}`);
+ const { html, title } = await fetchPageContent(url);
+
+ // 转换为MDX
+ console.log(` 转换HTML为MDX...`);
+ const mdx = await convertToMDX(html, title, url);
+
+ // 写入文件
+ const filePath = getLocalPath(url);
+ console.log(` 写入 ${filePath}`);
+ await writeMDXFile(filePath, mdx, title);
+
+ // 创建PR
+ console.log(` 创建PR...`);
+ const prNumber = await createPullRequest(issue, filePath, url);
+
+ // 更新issue
+ console.log(` 更新issue...`);
+ await updateIssue(issue, prNumber);
+
+ console.log(` issue #${issue.number} 完成`);
+ } catch (error) {
+ console.error(` issue #${issue.number} 出错:`, error);
+ await updateIssue(issue, null, error);
+ }
+ }
+
+ console.log("全部完成");
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index b8f92c0b..ad6b79ca 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -17,9 +17,25 @@
"starlight-heading-badges": "0.6.1"
},
"devDependencies": {
+ "@octokit/rest": "^21.0.2",
+ "jsdom": "^26.0.0",
"prettier": "3.6.2"
}
},
+ "node_modules/@asamuzakjp/css-color": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz",
+ "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@csstools/css-calc": "^2.1.3",
+ "@csstools/css-color-parser": "^3.0.9",
+ "@csstools/css-parser-algorithms": "^3.0.4",
+ "@csstools/css-tokenizer": "^3.0.3",
+ "lru-cache": "^10.4.3"
+ }
+ },
"node_modules/@astrojs/compiler": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.13.0.tgz",
@@ -234,6 +250,121 @@
"node": ">=18"
}
},
+ "node_modules/@csstools/color-helpers": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz",
+ "integrity": "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT-0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@csstools/css-calc": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz",
+ "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-parser-algorithms": "^3.0.5",
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-color-parser": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.1.0.tgz",
+ "integrity": "sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@csstools/color-helpers": "^5.1.0",
+ "@csstools/css-calc": "^2.1.4"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-parser-algorithms": "^3.0.5",
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-parser-algorithms": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz",
+ "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-tokenizer": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz",
+ "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@ctrl/tinycolor": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-4.2.0.tgz",
@@ -1235,6 +1366,206 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/@octokit/auth-token": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.2.tgz",
+ "integrity": "sha512-JcQDsBdg49Yky2w2ld20IHAlwr8d/d8N6NiOXbtuoPCqzbsiJgF633mVUw3x4mo0H5ypataQIX7SFu3yy44Mpw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/core": {
+ "version": "6.1.6",
+ "resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.6.tgz",
+ "integrity": "sha512-kIU8SLQkYWGp3pVKiYzA5OSaNF5EE03P/R8zEmmrG6XwOg5oBjXyQVVIauQ0dgau4zYhpZEhJrvIYt6oM+zZZA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/auth-token": "^5.0.0",
+ "@octokit/graphql": "^8.2.2",
+ "@octokit/request": "^9.2.3",
+ "@octokit/request-error": "^6.1.8",
+ "@octokit/types": "^14.0.0",
+ "before-after-hook": "^3.0.2",
+ "universal-user-agent": "^7.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/endpoint": {
+ "version": "10.1.4",
+ "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.4.tgz",
+ "integrity": "sha512-OlYOlZIsfEVZm5HCSR8aSg02T2lbUWOsCQoPKfTXJwDzcHQBrVBGdGXb89dv2Kw2ToZaRtudp8O3ZIYoaOjKlA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^14.0.0",
+ "universal-user-agent": "^7.0.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/graphql": {
+ "version": "8.2.2",
+ "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.2.2.tgz",
+ "integrity": "sha512-Yi8hcoqsrXGdt0yObxbebHXFOiUA+2v3n53epuOg1QUgOB6c4XzvisBNVXJSl8RYA5KrDuSL2yq9Qmqe5N0ryA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/request": "^9.2.3",
+ "@octokit/types": "^14.0.0",
+ "universal-user-agent": "^7.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/openapi-types": {
+ "version": "25.1.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz",
+ "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@octokit/plugin-paginate-rest": {
+ "version": "11.6.0",
+ "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.6.0.tgz",
+ "integrity": "sha512-n5KPteiF7pWKgBIBJSk8qzoZWcUkza2O6A0za97pMGVrGfPdltxrfmfF5GucHYvHGZD8BdaZmmHGz5cX/3gdpw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.10.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "@octokit/core": ">=6"
+ }
+ },
+ "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": {
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": {
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^24.2.0"
+ }
+ },
+ "node_modules/@octokit/plugin-request-log": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-5.3.1.tgz",
+ "integrity": "sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "@octokit/core": ">=6"
+ }
+ },
+ "node_modules/@octokit/plugin-rest-endpoint-methods": {
+ "version": "13.5.0",
+ "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.5.0.tgz",
+ "integrity": "sha512-9Pas60Iv9ejO3WlAX3maE1+38c5nqbJXV5GrncEfkndIpZrJ/WPMRd2xYDcPPEt5yzpxcjw9fWNoPhsSGzqKqw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^13.10.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "@octokit/core": ">=6"
+ }
+ },
+ "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": {
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": {
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^24.2.0"
+ }
+ },
+ "node_modules/@octokit/request": {
+ "version": "9.2.4",
+ "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.4.tgz",
+ "integrity": "sha512-q8ybdytBmxa6KogWlNa818r0k1wlqzNC+yNkcQDECHvQo8Vmstrg18JwqJHdJdUiHD2sjlwBgSm9kHkOKe2iyA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/endpoint": "^10.1.4",
+ "@octokit/request-error": "^6.1.8",
+ "@octokit/types": "^14.0.0",
+ "fast-content-type-parse": "^2.0.0",
+ "universal-user-agent": "^7.0.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/request-error": {
+ "version": "6.1.8",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.8.tgz",
+ "integrity": "sha512-WEi/R0Jmq+IJKydWlKDmryPcmdYSVjL3ekaiEL1L9eo1sUnqMJ+grqmC9cjk7CA7+b2/T397tO5d8YLOH3qYpQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/types": "^14.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/rest": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-21.1.1.tgz",
+ "integrity": "sha512-sTQV7va0IUVZcntzy1q3QqPm/r8rWtDCqpRAmb8eXXnKkjoQEtFe3Nt5GTVsHft+R6jJoHeSiVLcgcvhtue/rg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/core": "^6.1.4",
+ "@octokit/plugin-paginate-rest": "^11.4.2",
+ "@octokit/plugin-request-log": "^5.3.1",
+ "@octokit/plugin-rest-endpoint-methods": "^13.3.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/@octokit/types": {
+ "version": "14.1.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz",
+ "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@octokit/openapi-types": "^25.1.0"
+ }
+ },
"node_modules/@oslojs/encoding": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz",
@@ -1844,6 +2175,16 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
+ "node_modules/agent-base": {
+ "version": "7.1.4",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
+ "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/ansi-align": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz",
@@ -2176,6 +2517,13 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/before-after-hook": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz",
+ "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
"node_modules/boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
@@ -2508,6 +2856,34 @@
"integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==",
"license": "CC0-1.0"
},
+ "node_modules/cssstyle": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz",
+ "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@asamuzakjp/css-color": "^3.2.0",
+ "rrweb-cssom": "^0.8.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/data-urls": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz",
+ "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "whatwg-mimetype": "^4.0.0",
+ "whatwg-url": "^14.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
@@ -2525,6 +2901,13 @@
}
}
},
+ "node_modules/decimal.js": {
+ "version": "10.6.0",
+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
+ "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/decode-named-character-reference": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz",
@@ -2946,6 +3329,23 @@
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
"license": "MIT"
},
+ "node_modules/fast-content-type-parse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz",
+ "integrity": "sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "MIT"
+ },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -3429,6 +3829,19 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/html-encoding-sniffer": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
+ "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "whatwg-encoding": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/html-escaper": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
@@ -3461,6 +3874,34 @@
"integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==",
"license": "BSD-2-Clause"
},
+ "node_modules/http-proxy-agent": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
+ "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.0",
+ "debug": "^4.3.4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/i18next": {
"version": "23.16.8",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-23.16.8.tgz",
@@ -3484,6 +3925,19 @@
"@babel/runtime": "^7.23.2"
}
},
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/import-meta-resolve": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz",
@@ -3607,6 +4061,13 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/is-potential-custom-element-name": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
+ "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/is-wsl": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz",
@@ -3634,6 +4095,46 @@
"js-yaml": "bin/js-yaml.js"
}
},
+ "node_modules/jsdom": {
+ "version": "26.1.0",
+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz",
+ "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cssstyle": "^4.2.1",
+ "data-urls": "^5.0.0",
+ "decimal.js": "^10.5.0",
+ "html-encoding-sniffer": "^4.0.0",
+ "http-proxy-agent": "^7.0.2",
+ "https-proxy-agent": "^7.0.6",
+ "is-potential-custom-element-name": "^1.0.1",
+ "nwsapi": "^2.2.16",
+ "parse5": "^7.2.1",
+ "rrweb-cssom": "^0.8.0",
+ "saxes": "^6.0.0",
+ "symbol-tree": "^3.2.4",
+ "tough-cookie": "^5.1.1",
+ "w3c-xmlserializer": "^5.0.0",
+ "webidl-conversions": "^7.0.0",
+ "whatwg-encoding": "^3.1.1",
+ "whatwg-mimetype": "^4.0.0",
+ "whatwg-url": "^14.1.1",
+ "ws": "^8.18.0",
+ "xml-name-validator": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "canvas": "^3.0.0"
+ },
+ "peerDependenciesMeta": {
+ "canvas": {
+ "optional": true
+ }
+ }
+ },
"node_modules/kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@@ -4878,6 +5379,13 @@
"url": "https://github.com/fb55/nth-check?sponsor=1"
}
},
+ "node_modules/nwsapi": {
+ "version": "2.2.22",
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.22.tgz",
+ "integrity": "sha512-ujSMe1OWVn55euT1ihwCI1ZcAaAU3nxUiDwfDQldc51ZXaB9m2AyOn6/jh1BLe2t/G8xd6uKG1UBF2aZJeg2SQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/ofetch": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz",
@@ -5183,6 +5691,16 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/radix3": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz",
@@ -5636,12 +6154,39 @@
"fsevents": "~2.3.2"
}
},
+ "node_modules/rrweb-cssom": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
+ "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/sax": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.3.tgz",
"integrity": "sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==",
"license": "BlueOak-1.0.0"
},
+ "node_modules/saxes": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
+ "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "xmlchars": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=v12.22.7"
+ }
+ },
"node_modules/semver": {
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
@@ -5913,6 +6458,13 @@
"url": "https://opencollective.com/svgo"
}
},
+ "node_modules/symbol-tree": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
+ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/tiny-inflate": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
@@ -5950,6 +6502,52 @@
"url": "https://github.com/sponsors/SuperchupuDev"
}
},
+ "node_modules/tldts": {
+ "version": "6.1.86",
+ "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
+ "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tldts-core": "^6.1.86"
+ },
+ "bin": {
+ "tldts": "bin/cli.js"
+ }
+ },
+ "node_modules/tldts-core": {
+ "version": "6.1.86",
+ "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz",
+ "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tough-cookie": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz",
+ "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "tldts": "^6.1.32"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/tr46": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
+ "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "punycode": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/trim-lines": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
@@ -6232,6 +6830,13 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/universal-user-agent": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
+ "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/unstorage": {
"version": "1.17.3",
"resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.3.tgz",
@@ -6469,6 +7074,19 @@
}
}
},
+ "node_modules/w3c-xmlserializer": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
+ "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "xml-name-validator": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/web-namespaces": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz",
@@ -6479,6 +7097,53 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/webidl-conversions": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/whatwg-encoding": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
+ "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "iconv-lite": "0.6.3"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/whatwg-mimetype": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
+ "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/whatwg-url": {
+ "version": "14.2.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
+ "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tr46": "^5.1.0",
+ "webidl-conversions": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/which-pm-runs": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz",
@@ -6520,6 +7185,45 @@
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
+ "node_modules/ws": {
+ "version": "8.18.3",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
+ "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/xml-name-validator": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
+ "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/xmlchars": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
+ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/xxhash-wasm": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz",
diff --git a/package.json b/package.json
index 44aa9a3a..0fe3ce19 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,8 @@
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
- "format": "prettier --write ."
+ "format": "prettier --write .",
+ "migrate": "node migrate/migrate-bot.js"
},
"dependencies": {
"@astrojs/starlight": "^0.36.2",
@@ -20,6 +21,8 @@
"starlight-heading-badges": "0.6.1"
},
"devDependencies": {
- "prettier": "3.6.2"
+ "prettier": "3.6.2",
+ "@octokit/rest": "^21.0.2",
+ "jsdom": "^26.0.0"
}
}
From 8d89011311088c910221258c2ad6c24caaf8ab3a Mon Sep 17 00:00:00 2001
From: MicroBlock <66859419+std-microblock@users.noreply.github.com>
Date: Tue, 2 Dec 2025 16:50:44 +0800
Subject: [PATCH 11/11] style: run prettier
---
.github/workflows/migrate.yml | 4 +-
migrate/migrate-bot.js | 69 ++++++++++++++++++++++-------------
src/components/index.ts | 29 ++++++++++++---
src/lib/doc-index.ts | 7 ++--
4 files changed, 74 insertions(+), 35 deletions(-)
diff --git a/.github/workflows/migrate.yml b/.github/workflows/migrate.yml
index 116b023c..ca961f62 100644
--- a/.github/workflows/migrate.yml
+++ b/.github/workflows/migrate.yml
@@ -8,7 +8,7 @@ on:
workflow_dispatch:
inputs:
issue_number:
- description: 'Specific issue number to process (optional)'
+ description: "Specific issue number to process (optional)"
required: false
type: string
@@ -46,4 +46,4 @@ jobs:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
- run: npm run migrate
\ No newline at end of file
+ run: npm run migrate
diff --git a/migrate/migrate-bot.js b/migrate/migrate-bot.js
index b19ed02b..3edd1dc9 100644
--- a/migrate/migrate-bot.js
+++ b/migrate/migrate-bot.js
@@ -55,33 +55,43 @@ async function fetchPageContent(url) {
}
async function convertToMDX(html, title, url) {
- const prompt = await readFile(__dirname + "/PROMPT.md", "utf8")
- .replace("{{LLM_DOCS}}", await readFile(__dirname + "/../src/content/docs/development/guide/component-docs-for-llm.mdx", "utf8"));
-
- const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
- method: "POST",
- headers: {
- Authorization: `Bearer ${OPENROUTER_API_KEY}`,
- "Content-Type": "application/json",
- "HTTP-Referer": "https://github.com/cppdoc/cppdoc",
- "X-Title": "CppDoc Migration Bot",
- },
- body: JSON.stringify({
- model: "deepseek/deepseek-v3.2",
- messages: [
- { role: "system", content: prompt },
- { role: "user", content:
-`
+ const prompt = await readFile(__dirname + "/PROMPT.md", "utf8").replace(
+ "{{LLM_DOCS}}",
+ await readFile(
+ __dirname +
+ "/../src/content/docs/development/guide/component-docs-for-llm.mdx",
+ "utf8",
+ ),
+ );
+
+ const response = await fetch(
+ "https://openrouter.ai/api/v1/chat/completions",
+ {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${OPENROUTER_API_KEY}`,
+ "Content-Type": "application/json",
+ "HTTP-Referer": "https://github.com/cppdoc/cppdoc",
+ "X-Title": "CppDoc Migration Bot",
+ },
+ body: JSON.stringify({
+ model: "deepseek/deepseek-v3.2",
+ messages: [
+ { role: "system", content: prompt },
+ {
+ role: "user",
+ content: `
// Convert the following HTML content from cppreference.com into MDX format suitable for CppDoc.
// Title: ${title}
// URL: ${url}
// HTML Content:
${html}
-`
- }
- ],
- }),
- });
+`,
+ },
+ ],
+ }),
+ },
+ );
if (!response.ok) {
const error = await response.text();
@@ -99,7 +109,14 @@ function getLocalPath(url) {
throw new Error(`无法从URL解析路径: ${url}`);
}
const relative = match[1]; // "cpp/comments"
- return path.join(__dirname, "..", "src", "content", "docs", `${relative}.mdx`);
+ return path.join(
+ __dirname,
+ "..",
+ "src",
+ "content",
+ "docs",
+ `${relative}.mdx`,
+ );
}
async function writeMDXFile(filePath, content, title) {
@@ -122,7 +139,9 @@ async function createPullRequest(issue, filePath, url) {
const { execSync } = await import("child_process");
try {
execSync(`git config user.name "github-actions[bot]"`);
- execSync(`git config user.email "github-actions[bot]@users.noreply.github.com"`);
+ execSync(
+ `git config user.email "github-actions[bot]@users.noreply.github.com"`,
+ );
execSync(`git checkout -b ${branchName}`);
execSync(`git add "${filePath}"`);
execSync(`git commit -m "${commitMessage}"`);
@@ -235,4 +254,4 @@ async function main() {
main().catch((err) => {
console.error(err);
process.exit(1);
-});
\ No newline at end of file
+});
diff --git a/src/components/index.ts b/src/components/index.ts
index 52d3e1ae..580fa4ef 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -4,7 +4,10 @@ import { DescList, Desc } from "@components/desc-list";
import { ParamDocList, ParamDoc } from "@components/param-doc";
import DocLink from "@components/DocLink.astro";
import { CHeader, CppHeader } from "@components/header";
-import { FeatureTestMacro, FeatureTestMacroValue } from "@components/feature-test-macro";
+import {
+ FeatureTestMacro,
+ FeatureTestMacroValue,
+} from "@components/feature-test-macro";
import { DR, DRList } from "@components/defect-report";
import { Revision, RevisionBlock } from "@components/revision";
import AutoCollapse from "@components/AutoCollapse.astro";
@@ -12,7 +15,23 @@ import FlexTable from "@components/FlexTable.astro";
import WG21PaperLink from "@components/WG21PaperLink.astro";
export {
- Behavior, Decl, DeclDoc, DescList, Desc, ParamDocList, ParamDoc, DocLink,
- CHeader, CppHeader, FeatureTestMacro, FeatureTestMacroValue, DR, DRList,
- Revision, RevisionBlock, AutoCollapse, FlexTable, WG21PaperLink
-};
\ No newline at end of file
+ Behavior,
+ Decl,
+ DeclDoc,
+ DescList,
+ Desc,
+ ParamDocList,
+ ParamDoc,
+ DocLink,
+ CHeader,
+ CppHeader,
+ FeatureTestMacro,
+ FeatureTestMacroValue,
+ DR,
+ DRList,
+ Revision,
+ RevisionBlock,
+ AutoCollapse,
+ FlexTable,
+ WG21PaperLink,
+};
diff --git a/src/lib/doc-index.ts b/src/lib/doc-index.ts
index fecf056d..37f227b6 100644
--- a/src/lib/doc-index.ts
+++ b/src/lib/doc-index.ts
@@ -58,10 +58,11 @@ async function getOrBuildKeyIndex(): Promise> {
export async function getLinkToKey(key: string): Promise {
const index = await getOrBuildKeyIndex();
if (key?.startsWith("/")) {
- if (index.values().some(slug => `/${slug}/` === key || `/${slug}` === key))
+ if (
+ index.values().some((slug) => `/${slug}/` === key || `/${slug}` === key)
+ )
return key;
- else
- return undefined;
+ else return undefined;
}
const slug = index.get(key);
if (!slug) return undefined;