Markdown course to moodle book convertor

For “reasons” I was looking for a way to convert an existing markdown-course to a “moodle book” resource. (I know, I know, not really the way to go, but still…). I found this interesting python-script that exactly does this, however, it’s not very up-to-date. My Python-skills aren’t very on par, but I did manage to make it work on Python 3.7 and you can find my updated script here.

The script works nice and well and even creates nice “code fragments” and is able to import your images:

Left=markdown , Right=book in Moodle


The main drawback currently is that the needs a very strict folder structure and filenames (all files and folders have to be numbered and need to contain a file per folder).

Things you need to consider:

  • Markdown blockquotes are converted to a rather large font (which you can change of course)
  • Each chapter needs it own \book folder where the actual content will be (which will mean to you might need to rearrange your existing markdown folder structure)
  • Use the -pagetitles option if you can’t import the newly created book archive because your page titles are too long: the script will use the first header as title in your markdown, but for reasons (yet) unbeknownst to me it also used the text following the header resulting in an HTML <title> that was too long for Moodle to work with.
  • Images need to be in a subfolder of each \book folder. Meaning you can’t use one big assets folder for all your chapters (something gitbook prefers)

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen. logo

Je reageert onder je account. Log uit /  Bijwerken )


Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s

Deze site gebruikt Akismet om spam te bestrijden. Ontdek hoe de data van je reactie verwerkt wordt.

%d bloggers liken dit:
search previous next tag category expand menu location phone mail time cart zoom edit close