mdx-to-markdown
Skill95 starsChanged 4 months agoMITView on GitHub
Convert `.mdx` to portable `.md`, cleaning MDX components, anchors, code titles, table-of-contents links, and root-relative docs links.
- Installs packages
In this repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- create-draft-release-notesSkill
- pr-creatorSkill
- release-blog-writerSkill
- rstack-docs-writerSkill
- rstack-eco-ci-debugSkill
- rstack-repo-maintainSkill
- rstack-skill-evaluatorSkill
- migrate-to-rsbuildSkill
- migrate-to-rslibSkill
- migrate-to-rslintSkill
- migrate-to-rstestSkill
- rsbuild-best-practicesSkill
- rsbuild-v2-upgradeSkill
- rsdoctor-analysisSkill
- rslib-best-practicesSkill
- rslib-modern-packageSkill
- rspack-best-practicesSkill
- rspack-debuggingSkill
- rspack-split-chunksSkill
- rspack-tracingSkill
- rspack-v2-upgradeSkill
- rspress-best-practicesSkill
- rspress-custom-themeSkill
- rspress-description-generatorSkill
- rspress-docs-generatorSkill
- rspress-v2-upgradeSkill
- rstest-best-practicesSkill
- rstest-debuggingSkill
- storybook-rsbuildSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use this skill to produce plain Markdown from MDX without requiring the target renderer to understand MDX imports, JSX components, Rspress …
- Distinctive: line 25
Run the helper script when the requested conversion matches the default rules:
- Distinctive: line 40
Remove Rspress heading anchor suffixes while keeping the heading text.
- Very specific: line 41
Remove standalone <a id="..."></a> anchor lines.
- Distinctive: line 42
Remove table-of-contents links that target in-page anchors, preserving the list text.
- Very specific: line 62
Add /zh to the prefix when the MDX path contains a zh path segment.
- Very specific: line 63
Use --link-prefix <prefix> only when the inferred domain is wrong or the user explicitly requests a custom prefix.
- Distinctive: line 67
Run targeted checks after conversion:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MDX to Markdown
Overview
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.
Workflow
- Identify the source
.mdxand target.mdpath. If the user gives only a source path, default the output to the same path with.md. - Inspect the MDX for non-Markdown constructs:
- YAML frontmatter.
- top-level
importlines. - custom components such as
<BlogAuthors />and<PackageManagerTabs />. - heading anchors like
### Title \{#title}. - standalone HTML anchors like
<a id="title"></a>. - fenced code block titles such as a JavaScript fence with
title="env.js". - HTML image wrappers such as centered
<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
rgand 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.
Default conversion rules
- Drop YAML frontmatter and top-level MDX imports.
- Remove
<BlogAuthors />. - Expand
<PackageManagerTabs command="add pkg -D" />to abashcode block usingpnpm 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]todiffcode 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.rs
- Add
/zhto the prefix when the MDX path contains azhpath segment. For example, a Chinese Rspack document converts/guide/optimization/tree-shakingtohttps://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.
Validation checklist
Run targeted checks after conversion:
rg -n '<BlogAuthors|PackageManagerTabs|title="|\\{#|^<a id="|\\]\(/|!code highlight|^\*\*[^*]+\*\*$' output.md
rg -n '^```' output.md | wc -lThe first command should return no matches unless the user intentionally kept that syntax. The fence count should be even.
Resources
scripts/convert_mdx_to_markdown.mjs: deterministic converter for the common Rspack/Rstack release-blog MDX pattern.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

