一键导入
mdx-to-markdown
Convert `.mdx` to portable `.md`, cleaning MDX components, anchors, code titles, table-of-contents links, and root-relative docs links.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Convert `.mdx` to portable `.md`, cleaning MDX components, anchors, code titles, table-of-contents links, and root-relative docs links.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when asked to create a pull request for this repository. It helps the PR follow the repository's branch safety rules, title convention, pull request template, and concise English writing style.
Use when analyzing Rspack/Webpack bundles from local `rsdoctor-data.json` and producing evidence-based optimization recommendations.
Debug Rstack ecosystem CI failures and attribute the real source PR or downstream change. Always use this skill when the user mentions Rspack eco-ci, rstack-ecosystem-ci, a suite turning red, a downstream regression, a green-to-red pivot, canary bisect, @rspack-canary/core, or daily eco-ci triage — even if they only ask "why is this suite failing", "which PR broke it", or "is this Rspack's fault". Use it to avoid over-blaming the first Rspack commit that appears red in status data.
Audit and modernize RstackJS/Rspack ecosystem repositories to the current shared infrastructure baseline: Rslib ESM or dual builds, Rslint recommended rules, Rstest test tooling, Node 20+ support where appropriate, TypeScript 6 and tsgo where compatible, concise README/AGENTS docs, release workflow cleanup, unused dependency removal, and infra PR commit conventions. Use when updating rstackjs repositories, copying infra patterns from maintained exemplars, or reviewing package/tooling consistency.
Benchmark agent skills by generating eval cases, comparing skill-guided vs baseline runs, and recording artifacts under skills-test/{skill-name}.
Generate or maintain Rspress documentation for a project. Use whenever the user wants to create a new Rspress v2 docs site, add docs for user-facing feature work or PRs, maintain a dedicated Rspress docs project in a monorepo, or prevent stale Rspress v1 scaffolds/version drift before documentation work. For full v1-to-v2 migration, hand off to the rspress-v2-upgrade skill.
| name | mdx-to-markdown |
| description | Convert `.mdx` to portable `.md`, cleaning MDX components, anchors, code titles, table-of-contents links, and root-relative docs links. |
| metadata | {"internal":true} |
Use this skill to produce plain Markdown from MDX without requiring the target renderer to understand MDX imports, JSX components, Rspress anchors, or code-block metadata.
Identify the source .mdx and target .md path. If the user gives only a source path, default the output to the same path with .md.
Inspect the MDX for non-Markdown constructs:
import lines.<BlogAuthors /> and <PackageManagerTabs />.### Title \{#title}.<a id="title"></a>.title="env.js".<div><img ... /></div>.Run the helper script when the requested conversion matches the default rules:
node /path/to/skills/mdx-to-markdown/scripts/convert_mdx_to_markdown.mjs input.mdx output.md
Review the result with rg and a short diff. Confirm that no MDX-only syntax remains.
Apply any user-requested follow-up edits, such as removing a generated table of contents or changing link policy.
Drop YAML frontmatter and top-level MDX imports.
Remove <BlogAuthors />.
Expand <PackageManagerTabs command="add pkg -D" /> to a bash code block using pnpm add pkg -D.
Convert centered HTML image blocks into Markdown image syntax.
Remove Rspress heading anchor suffixes while keeping the heading text.
Remove standalone <a id="..."></a> anchor lines.
Remove table-of-contents links that target in-page anchors, preserving the list text.
Convert code-fence titles or standalone bold filename captions into the first line of the code block as a comment, for example:
// hello.js
export function greet(name) {
return `Hello, ${name}!`;
}
console.log(greet('world'));
Convert code blocks that contain markers such as // [!code highlight] to diff code blocks, remove the marker, and prefix highlighted lines with +.
Prefix Markdown links whose target starts with / using the current repository's site domain. Infer the product from the input file's Git repository, remote, package name, or path segment:
rspack -> rspack.rsrsbuild -> rsbuild.rsrspress -> rspress.rsrslib -> rslib.rsrsdoctor -> rsdoctor.rsrstest -> rstest.rsAdd /zh to the prefix when the MDX path contains a zh path segment. For example, a Chinese Rspack document converts /guide/optimization/tree-shaking to https://rspack.rs/zh/guide/optimization/tree-shaking.
Use --link-prefix <prefix> only when the inferred domain is wrong or the user explicitly requests a custom prefix.
Run targeted checks after conversion:
rg -n '<BlogAuthors|PackageManagerTabs|title="|\\{#|^<a id="|\\]\(/|!code highlight|^\*\*[^*]+\*\*$' output.md
rg -n '^```' output.md | wc -l
The first command should return no matches unless the user intentionally kept that syntax. The fence count should be even.
scripts/convert_mdx_to_markdown.mjs: deterministic converter for the common Rspack/Rstack release-blog MDX pattern.