Migrating a Google Doc into MediaWiki

From MemoryLeak
Revision as of 20:40, 14 August 2026 by Kmilleca (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Question: Should I copy and paste a Google Doc into the wiki editor, or download it in a specific format first?

Answer: Copy-paste brings along Google's inline styling as messy HTML/CSS that the MediaWiki editor will either choke on or render literally. It's cleaner to download the doc and convert it with a dedicated tool.

pandoc -f docx -t mediawiki --extract-media=./images -o article.wiki mydoc.docx

Pandoc's MediaWiki writer handles headings, bold/italic, bullet and numbered lists, tables, and internal links cleanly. The --extract-media flag pulls embedded images into a folder so they don't need to be re-sourced separately.

Steps after conversion:

  1. Open article.wiki and skim it — pandoc is good but not perfect, so check tables and nested lists especially.
  2. Paste the wikitext into the MediaWiki edit box.
  3. Upload the extracted images separately via Special:Upload (or php maintenance/importImages.php for batches), and fix up File:... references, since pandoc's image syntax sometimes needs a tweak to match MediaWiki's expected format.

Why .docx over other export formats

  • HTML export also works with pandoc (-f html) and is arguably cleaner for text since it skips OOXML overhead, but Google's HTML export bundles images as a zip with separate numbered files — an extra unzip step compared to docx + --extract-media.
  • Markdown export (now offered by Google Docs) sounds convenient but tends to flatten structure — especially tables and footnotes — worse than docx does through pandoc's OOXML parser.
  • .odt / .rtf — skip these; no real advantage over docx for this pipeline.

Offer: Paste the resulting article.wiki content here for a cleanup pass — fixing heading levels, converting leftover HTML artifacts to wikitext, adding categories, etc. — before publishing.