Convert AsciiDoc to Markdown
docsbot convert turns AsciiDoc into Markdown for the site generator you are moving to.
Most converters silently lose what Markdown cannot express. docsbot reports it instead:
every construct that was approximated, dropped or needs review, with its file and line, so
a migration can be checked rather than trusted.
The converter is written in Go. You do not need Pandoc or Asciidoctor.
Convert a folder
docsbot convert docs/modules --out markdown --target mkdocs
The AsciiDoc is never changed. --out must be a different folder from the source.
Choose the target that matches your new site. It decides the admonition syntax, list style and heading anchors:
--target |
Admonitions become |
|---|---|
gfm (default) |
GitHub alerts (> [!NOTE]) |
mkdocs |
!!! note blocks |
docusaurus |
:::note blocks |
hugo |
Hugo alerts (> [!NOTE], with the title after the marker) |
commonmark |
block quotes that start with a bold label (> **Note:**) |
If the new site generates heading anchors differently from GitHub, set --anchor-style
(github, mkdocs, kramdown or sphinx) so cross references still land.
Preview first
docsbot convert docs --out /tmp/md --dry-run
--dry-run writes nothing and reports what would be converted.
Pass attribute values
Documents often depend on attributes set by the build, such as {product} or
{version}. Pass them on the command line; they override values set in the documents:
docsbot convert docs --out md --attr product=Lumen --attr version=2.1
Conditionals (ifdef, ifndef, ifeval) are evaluated with these values. Every
conditional is reported. Ones that cannot be evaluated are kept and marked for review, or
dropped with --unknown drop.
What is converted
- Attributes:
{name}references are substituted. - Includes: inlined, with tags, line ranges and
leveloffset. Files that other files include are not converted on their own. - Antora: resource IDs and component attributes.
- Cross references:
xref:and<<>>point at the target heading’s Markdown anchor. - Tables: GitHub pipe tables, or HTML when cells are merged or contain blocks.
- Admonitions, callouts, description lists and images.
The document title always goes into front matter. Add --h1 to also write it as a
level-1 heading.
Read the report
Every run writes convert-report.md and convert-report.json into the output folder.
Each entry is one of:
| Status | Meaning |
|---|---|
| approximated | converted, but looks or behaves differently in Markdown |
| dropped | not in the output |
| review | unresolved, or raw markup was kept |
A content check also lists source lines whose words are missing from the output, as a safety net for anything the converter did not know it lost.
Converting the same input twice gives the same files, and files are only rewritten when they change, so you can convert repeatedly during a migration and review the diff.
Check the result
docsbot convert docs --out md --check
--check runs the link and image checks on the converted Markdown, offline. Run the full
docsbot check once the files are in the new site.