Skip to content

Commit 181aa7e

Browse files
authored
Add migration guide (#64)
1 parent 4ce8f89 commit 181aa7e

File tree

8 files changed

+136
-27
lines changed

8 files changed

+136
-27
lines changed

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Contribute to CppDoc
2+
3+
## Migrate a page from cppreference to CppDoc
4+
5+
We're now in the process of migrating contents from [cppreference] to CppDoc. Please checkout our [migration guide](https://cppdoc.cc/development/migration) for guidelines.
6+
7+
## Report a documentation bug
8+
9+
We use GitHub issues to track documentation bugs. To report a bug, please [opening a new GitHub issue](https://github.com/cppdoc-cc/cppdoc/issues/new).
10+
11+
## Add new content
12+
13+
> [!NOTE]
14+
> Incomplete.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ You can report a bug or request a new feature by [opening a new GitHub issue](ht
3636

3737
If you have made some changes, you can [open a new GitHub pull request](https://github.com/cppdoc-cc/cppdoc/compare).
3838

39+
For more information on contributing to CppDoc, please refer to our [contribution guide](./CONTRIBUTING.md).
40+
3941
## License
4042

4143
The content of the documentation is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International license](./LICENSE.CC-BY-SA-4.0) and the [GNU Free Documentation License](./LICENSE.GFDL). The underlying source code used to process, format, and display that content is licensed under the [MIT license](./LICENSE.MIT).

astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import starlightHeadingBadges from "starlight-heading-badges";
1010
export default defineConfig({
1111
site: process.env.CPPDOC_SITE,
1212
base: process.env.CPPDOC_BASE,
13+
trailingSlash: "never",
1314
integrations: [
1415
starlight({
1516
title: "CppDoc",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
label: Development Guideline
2-
order: 2
2+
order: 3

src/content/docs/development/guide/doc-everything.mdx

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -271,47 +271,24 @@ The `ParamDocList` component can be used to document function or template parame
271271

272272
## Links
273273

274-
### Link by Doc Keys
274+
### Link to Another CppDoc Page
275275

276-
Each page could optionally associate itself with zero or more _doc keys_ through its frontmatter.
277-
278-
```mdx {4}
279-
---
280-
title: std::move
281-
cppdoc:
282-
keys: ["cpp.library.utilities.move"]
283-
cppdoc:
284-
lang: C++
285-
since: C++11
286-
---
287-
```
288-
289-
<Aside type="caution">
290-
While a page can have multiple doc keys, each unique doc key can only be associated to at most one page.
291-
</Aside>
292-
293-
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.
276+
The `DocLink` component allows you to render an inline link to a specified CppDoc page. The path to the target page must be an absolute path.
294277

295278
```mdx
296279
import DocLink from "@components/DocLink.astro";
297280

298-
Check out
299-
<DocLink src="cpp.library.utilities.move">this page</DocLink>
300-
for more information about `std::move`.
301-
302281
Check out
303282
<DocLink src="/cpp/library/utilities/move">this page</DocLink>
304283
for more information about `std::move`.
305284
```
306285

307286
<Card title="Preview">
308-
Check out <DocLink src="cpp.library.utilities.move">this page</DocLink> for detailed information about `std::move`.
309-
310287
Check out <DocLink src="/cpp/library/utilities/move">this page</DocLink> for more information about `std::move`.
311288
</Card>
312289

313290
<Aside type="tip">
314-
If the specified doc key does not exist yet, the `DocLink` component will render as a plain text span without a link.
291+
If the specified page does not exist yet, the `DocLink` component will render as a plain text span without a link.
315292
</Aside>
316293

317294
### Link to Header
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
label: Migration Guide
2+
order: 2
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Migration Guidelines
3+
sidebar:
4+
order: 2
5+
---
6+
7+
import { Aside } from "@astrojs/starlight/components";
8+
9+
This document gives guidelines to migrate content from cppreference to CppDoc.
10+
11+
<Aside type="tip">
12+
For a more detailed guideline about writing CppDoc contents, please check out the [development guideline](../guide).
13+
</Aside>
14+
15+
<Aside type="note">
16+
This document is a work in progress. Incomplete content is expected.
17+
</Aside>
18+
19+
## Page Revisions
20+
21+
If the entire page is associated with specific C/C++ standard revisions, make sure the revisions are specified in the `cppdoc.revision` frontmatter:
22+
23+
```mdx
24+
---
25+
title: Page Title
26+
cppdoc:
27+
revision:
28+
lang: C++
29+
since: C++11
30+
until: C++20
31+
---
32+
```
33+
34+
The `since` and `until` fields are both optional.
35+
36+
## Cross References
37+
38+
Cross references are links within a CppDoc page that point to another CppDoc page. Please make sure all cross references are established using the [`DocLink` component](../guide/doc-everything#link-to-another-cppdoc-page).
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Migration Workflow
3+
sidebar:
4+
order: 1
5+
---
6+
7+
import { Aside, LinkCard } from "@astrojs/starlight/components";
8+
9+
We're now in the process of migrating pages from [cppreference] to CppDoc. To start, check out our live-updated [migration progress document](https://github.com/cppdoc-cc/cppdoc/blob/migrate-progress/CPPREF_MIGRATE_PROGRESS.md) on GitHub. This document lists all pages on cppreference and their migration status. Choose a page that has not been migrated yet, and you could start migrating it. You could either migrate the page [manually](#migrate-a-page-manually) or [with the help of an AI agent](#migrate-a-page-with-the-help-of-an-ai-agent).
10+
11+
[cppreference]: https://en.cppreference.com/index.html
12+
13+
Here are pages that you may constantly find useful during migration.
14+
15+
<LinkCard
16+
title="Migration Content Guideline"
17+
href="migration/guideline"
18+
description="Guidelines for migrating content from cppreference to CppDoc."
19+
/>
20+
21+
<LinkCard
22+
title="Development Guideline"
23+
href="./guide"
24+
description="Detailed development guidelines for writing CppDoc contents."
25+
/>
26+
27+
## Migrate a page manually
28+
29+
Once you selected a cppreference page to migrate, check out the file [`slug_map.json`](https://github.com/cppdoc-cc/cppdoc/blob/main/migrate/slug_map.json), which provides a mapping from cppreference slugs to CppDoc slugs, to find the slug of the corresponding page in CppDoc. This file is rather large, you could use your browser's search function to locate the entry for the cppreference page you want to migrate.
30+
31+
For example, if the cppreference page you want to migrate is `cpp/concepts/integral`, you could find the following entry in `slug_map.json` related to the page:
32+
33+
```json
34+
{
35+
"cppref": "cpp/concepts/integral",
36+
"cppdoc": "cpp/library/concepts/integral"
37+
}
38+
```
39+
40+
So the slug of the migrated CppDoc page should be `cpp/library/concepts/integral`. This is where you should create the new CppDoc page.
41+
42+
<Aside type="tip">
43+
Contact the community if either:
44+
- You cannot find an entry in `slug_map.json` for your selected cppreference page.
45+
- The entry in `slug_map.json` says the CppDoc slug is `null`.
46+
- You think the CppDoc slug recorded in `slug_map.json` is not appropriate for some reasons.
47+
</Aside>
48+
49+
After determining the CppDoc slug of the migrated page, you could create the page and start migrating page contents from cppreference to CppDoc. Please follow our documentation convention during migration.
50+
51+
When everything is finished, [create a pull request](https://github.com/cppdoc-cc/cppdoc/compare) to submit your changes. The community will review your changes and provide feedback. If everything goes well, your changes will be merged and deployed to the live website immediately after merge.
52+
53+
## Migrate a page with the help of an AI agent
54+
55+
To make our life easier, we have an experimental AI agent that could help you migrate a page. Its usage is completely optional.
56+
57+
The agent is embedded into the GitHub actions pipeline. It grabs a cppreference page you specified, try hard to rewrite it in CppDoc convention, and eventually creates a pull request. Once the pull request is opened, you and other community members could review it and make further changes on it.
58+
59+
<Aside type="note">
60+
AI agent is far from perfect and in most occassions its output must be changed further to meet our standards. The agent may also output complete garbage, in which case you have to either re-run the agent or migrate the page by hand.
61+
</Aside>
62+
63+
<Aside type="tip">
64+
AI agent works best when the size of the page is relatively small and similar pages have already been migrated before. If you're migrating a large page, or similar content on the page has not been migrated before, the quality of the agent output could drop dramastically. In such cases we recommend migrate the page by hand.
65+
</Aside>
66+
67+
To start, select a cppreference page which has not been migrated in the [migration progress document](https://github.com/cppdoc-cc/cppdoc/blob/migrate-progress/CPPREF_MIGRATE_PROGRESS.md).
68+
69+
Then click the "create" link in the "CppDoc Link" table column. This will take you to a pre-filled "new GitHub issue" page. The new issue's title is the URL to the cppreference page, and the new issue has an issue label `migrate-cppref-page`. After filling in any descriptive text for the new issue, click the "Create" button to create the issue.
70+
71+
Creation of the new issue will trigger the execution of an GitHub Action workflow. The workflow will invoke the AI agent to migrate the page. After the agent finishes, it will automatically create a draft pull request with the migrated page. Review the migrated content, make any necessary changes, and mark the pull request ready when done. The community will review your changes and provide feedback. If everything goes well, your changes will be merged and deployed to the live website immediately after merge.
72+
73+
<Aside type="tip">
74+
If you cannot edit the pull request created by the agent, contact community members for acquiring write access to the CppDoc repository.
75+
</Aside>

0 commit comments

Comments
 (0)