For years, our product documentation lived in a proprietary XML editorial system. Manuals got published, so in a narrow sense it worked. But the authoring tool was closed, the storage format was closed, and only one or two people really understood the publishing pipeline. It was a place to keep documentation, not a foundation to build on.
The problem wasn't the writing
The content itself was in good shape. Everything around it wasn't. The system had never been set up for versioning, so we maintained a single main line of documentation. Reviews ran over email, with exported files attached. And since nothing outside the editorial tool could read its format, the content was out of reach for CI pipelines, search indexes and, eventually, AI assistants.
Docs-as-Code — AsciiDoc source in Git, built and published with Antora — solved all of that at once:
- Reviews like code. The docs live in a repository and go through the same pull requests as everything else in R&D.
- Real versions. The docs branch with the product. Antora builds each release branch as its own version of the site, so the documentation for an older release stays available and can still be fixed.
- Scriptable content. Plain text can be checked and transformed with ordinary tools, starting with the migration itself.
- More than one reader. A build pipeline, a linter and, later, a retrieval system for an AI chatbot can all read the same source.
Making the decision was the easy part. Getting years of content across was not.
Step one: let the old system do the hard part
Underneath, the storage format was XML, in the vendor's own schema. Converting it directly would have meant writing XSLT. I had used XSLT before, but for fairly simple data conversions. Mapping a large, vendor-specific schema onto AsciiDoc would have been a different league, and painful to work with. But the editorial system already knew how to turn its XML into something else: it could publish the complete online help as HTML, in German and English. So I let it handle that step and started from the HTML export. From there on, the job was Python and pandoc, which I knew well.
The export was a website, not a document, so the first script cleaned it up with BeautifulSoup. It removed the header, footer and related-links box, dropped index-entry markers and stray <span> elements from captions, removed fixed image sizes, and unwrapped italics inside notes so they would convert cleanly. Tables needed the most care. Pandoc didn't handle merged cells (colspan) well, so the script replaced each merged cell with the original plus empty cells, keeping every row the same width. A condensed version of fixHTML.py:
from bs4 import BeautifulSoup
from copy import deepcopy
import os
def replicate_cell(cell):
colspan = int(cell['colspan'])
del cell.attrs['colspan']
# Replace the merged cell with itself plus (colspan - 1) empty cells
for _ in range(colspan - 1):
empty_cell = deepcopy(cell)
empty_cell.clear()
cell.insert_after(empty_cell)
for filename in os.listdir(os.getcwd()):
if not filename.endswith('.html'):
continue
with open(filename, 'r', encoding='utf-8') as file:
soup = BeautifulSoup(file, 'html.parser')
# Strip the website around the content
for element in [soup.find('header', class_='d-print-none'),
soup.find('section', class_='linklist-container'),
soup.find('footer')]:
if element:
element.decompose()
# Let Antora decide image sizes
for img in soup.find_all('img'):
img.attrs.pop('width', None)
img.attrs.pop('height', None)
# Flatten merged table cells so every row has the same number of columns
for cell in soup.find_all(attrs={'colspan': True}):
replicate_cell(cell)
with open(filename, 'w', encoding='utf-8') as file:
file.write(str(soup))
With the HTML cleaned up, pandoc did the conversion:
python3 fixHTML.py
for i in *.html; do
pandoc --wrap=none -f html -t asciidoc "$i" \
-o "../../output/pages/$i.adoc" --extract-media=../../output/images
done
Pandoc's output was valid AsciiDoc, but it still looked like a website: links to .html files, hard-coded image paths, generated anchors on every heading. A sed pass turned it into an Antora project:
for file in *.adoc; do
sed -i 's/\.html\[/\.adoc\[/g; s/\.html#/\.adoc#/g' "$file" # links point at .adoc
sed -i 's/link:/xref:/g' "$file" # links become Antora xrefs
sed -i 's|image:../../output/images/|image::|g' "$file" # Antora resolves images itself
sed -i 's/\[\[heading-[0-9]*\(-[0-9]*\)\?\]\]//g' "$file" # drop generated heading anchors
sed -i 's/^Advice: /NOTE: /; s/^Hinweis: /NOTE: /' "$file" # notes become admonitions
sed -i '0,/== /s//= /' "$file" # first heading becomes the page title
done
Two more small Python scripts handled the leftovers. The old help used little icons in running text, and those must not render as block images, so one script switched them back to the inline image: macro. The other removed the "margin texts" the old layout printed next to each section whenever they just repeated the heading above. Finally, the old table of contents became Antora's nav.adoc.
Per language, the HTML cleanup and conversion took about 20 minutes, and the AsciiDoc cleanup about half an hour. A few fixes stayed manual because a multi-line search-and-replace in VS Code was simply quicker: notes that pandoc had split into a heading plus an admonition, column widths on icon-legend tables, doubled "ATTENTION" labels that should be IMPORTANT: admonitions, and stray non-breaking spaces.
Step two: reshape it by hand, with scripts on call
After step one, the docs built, but they were still shaped like the old system. Every page was one node from the editorial system, named by its numeric ID (1158754699.adoc). Images had hashes for names. Content reused in several places existed as numbered copies (169960459-5.adoc), and many pages were just a heading and a paragraph.
Turning that into documentation people want to read was editorial work: deciding what belongs together, what goes, and what each page is for. But it came with plenty of mechanical work, and a second batch of scripts took care of that.
The biggest job was merging. I'd copy a slice of nav.adoc into a text file, and a script would pull out the file names, concatenate the pages in nav order and move the originals aside. Another script then read how deeply each entry was nested in the nav and set the heading levels in the merged page to match, so the old hierarchy survived. Sometimes the opposite was needed: a third script split a long page at its top-level headings and named each new file after its title instead of a number.
Merging broke links in a predictable way, because many cross-references now pointed into the file they lived in. A script rewrote those from xref:this-page.adoc#anchor[...] to the internal <<anchor>> form. Another listed every remaining anchor, and a regex found the numeric IDs left over from the old system. I relinked those by hand rather than carry legacy noise forward.
The rest kept the project manageable. One script took a list of the pages still referenced and moved everything else into a no_longer_needed folder, so nothing was deleted outright. Two others split the navigation at its top-level entries and zipped up the pages each section referenced, so the overhaul could be handed out section by section.
Step three: polish
Toward the end, the work got small and repetitive. I reran the margin-text and internal-link cleanups on newly restructured sections and moved files around as the docs were split into separate Antora components. The file-moving helper got a proper rewrite for that: a command-line tool that takes a list of files, a source module and a target module, with a --dry-run flag. When you're moving dozens of images between modules, you want to see the plan before anything happens.
A bonus: a corpus for AI
One sed pass from the overhaul turned out to be useful well beyond the migration. It replaced xrefs with their link text, removed images and table attribute lines, normalized notes and collapsed blank lines. What came out was plain text without markup noise, which is exactly what a retrieval system wants. With a few extra rules for export footers, the same approach worked for Confluence exports. That became the starting point for making the documentation AI-ready.
What changed for the team
For the writers, the daily routine changed from "open the tool, find the topic, edit it" to "clone the repo, edit the file, open a pull request." That's a bigger step than it sounds. It meant learning Git, reviewing diffs instead of exports, and trusting a build pipeline instead of a WYSIWYG preview. It paid off in review quality: an unintended change is much easier to spot in a diff than in a side-by-side export.
Multi-versioning was the second big shift. With a single main line, there was only ever one place to make a change. With a branch per release, every edit starts with a question: which versions does this apply to? A new feature goes into the upcoming release only. A correction to an existing procedure may need to land in several release branches. Writers had to learn to think in releases, and to carry a fix across branches instead of making it once and moving on.
In return, the documentation for each release now describes that release, not just the latest one. That sounds like the bare minimum anyone would expect from product documentation, and it is. But coming from a single main line, we got there in the end.