Migrate from Confluence XHTML

You can convert Atlassian Confluence XHTML pages to Asciidoctor using this Groovy script.

The script calls Pandoc to convert single or multiple HTML files exported from Confluence to AsciiDoc files. You’ll need Pandoc installed before running this script. If you have trouble running this script, you can use the Pandoc command referenced inside the script to convert XHTML files to AsciiDoc manually.

Unresolved include directive in modules/ROOT/pages/migrate/from-confluence-xhtml.adoc - include::https://gist.githubusercontent.com/melix/6020336/raw/059d83a3dae933de71d585c3f6b229a3c62fa857/convert.groovy[]

The script is designed to be run locally on HTML files or directories containing HTML files exported from Confluence.


  1. Save the script contents to a convert.groovy file in a working directory.

  2. Make the file executable according to your specific OS requirements.

  3. Place individual files, or a directory containing files into the working directory.

  4. Run groovy convert filename.html to convert a single file.

  5. Confirm the output file meets requirements

  6. Recurse through a directory by using this command pattern: groovy convert directory/*.html

This script was created by C├ędric Champeau (melix). You can find the source of this script hosted at this GitHub Gist.