Export a Moodle wiki to HTML or PDF, images included

Moodle's wiki has had no export since 2.0. Our free plugin downloads a whole wiki as offline web pages with images, plus one file to print or save as PDF.

Drawing of an open cobalt ring binder whose pages are tied by thin lines to a loose page and a small grey box.

Short answer: Moodle’s wiki has no export button. Our free plugin, Wiki download (report_wikidownload), adds More > Download wiki to every wiki. You get one zip that opens without Moodle: each page as a web page with its images, a contents page, and every page in one file that you print or save as PDF from the browser.

Moodle 1.9 could export a wiki to HTML; the wiki rewritten for Moodle 2.0 lost it. The request to bring it back, MDL-24439, has been open since 2010 with 65 votes and 52 watchers. When it went to the Moodle Users Association in 2023, people explained why: one site keeps hospital documentation in a wiki and copies pages into Word for a backup, another assesses students through wikis and must send their work to partner institutions for moderation. Moodle HQ found the full proposal too large, and commenters asked to start with a simple download. The plugin we found, local_wikiexport, was last released in 2023 for Moodle 3.11.

What is in the zip?

Wetland field guide.zip
  index.html        contents: the first page, then the rest by title
  all-pages.html    every page in one file, for printing or PDF
  Home.html         one web page per wiki page
  Herons.html
  files/heron.png   images and files attached to the wiki
  • Links between pages still work offline. Links to pages nobody has written yet become plain text.
  • HTML, Creole and NWiki wikis are all handled, images included.
  • Group and individual wikis get a folder each, and wikis of students who have left the course are kept.

Can I leave out student names?

For individual wikis, a second button downloads with folders named “Student 1”, “Student 2” instead of names, for sending work to an outside moderator. Names that students wrote inside their pages stay.

Who can download what?

Teachers and managers by default. The zip holds exactly the wikis the person could open in Moodle, because the plugin asks the wiki itself for each group or student wiki. Every download is logged.

What it does not do yet

Version 0.1 makes no PDF file of its own (print the all-pages file instead), and leaves out page history, comments and tags. It does not import wikis.

The code is on GitHub, for Moodle 4.5 to 5.3.

How we built it

  1. Moodle stores each wiki page in Creole, NWiki or HTML and turns it into HTML when someone views it, saving the result in a cache. The plugin renders pages the way the wiki’s printer-friendly view does, so the export writes nothing back and leaves out the “[edit]” links.
  2. Rendered pages link to each other through view.php?pageid=, and images through pluginfile.php (or a @@PLUGINFILE@@ placeholder in HTML wikis). The plugin points each one at the copy in the zip.
  3. Page titles become file names: characters Windows refuses are removed, and two titles that differ only in case get “(2)”.
  4. Tests: 16 PHPUnit tests (each wiki format with an image and a link, missing pages, individual and group wikis, hidden names, a student who left, what a student may see, no writes to the wiki) and 5 Behat scenarios with an accessibility check, on Moodle 4.5 to 5.3.

Need a plugin like this for your own Moodle?

Describe it in DevLMS Studio and watch it built and tested in a real Moodle, or ask our team for a fixed price.

Open DevLMS Studio