Transforming different Markdown dialect


first of all, thanks for this brilliant piece of software.

I’m currently considering to use Madoko, a Markdown processor for Latex and HTML ( for writing up some documentation which would allow me to export the result as PDF and use it for the Web, too. For the Web part, I would ideally like to use Grav but Madoko has (of course) a different set of Markdown tags than Grav so that some transformation is necessary; this mapping can be pretty complex but realistically I will be using only a number of markdowns that are specific to Madoko so in the simplest case it may just be some stripping of tags that are unknown to Grav (such as [TOC] for table of contents etc.) and some conversions where necessary (e.g. for inserting images etc.)

What would be the best place to do this kind of transformation? I thought of

  • shell scripts or Perl scripts that do some text processing before copying the markdown files to grav’s user folder
  • a Grav plugin
  • Some Twig wizardy (don’t think that this would work, though, as the conversion should probably happen be fore the content is passed to Twig)

Can you point me in the right direction for me to dig further?

Thanks a lot,


Parsedown (the markdown library we use) is quite tightly integrated into Grav. That said, it is possible to turn off Grav’s markdown with:

  markdown: false

In the user/config/system.yaml file, and then provide your own plugin to parse markdown. This would probably use the onPageContentProcessed() event to do any markdown parsing you want to do on the Page.

However, i couldn’t find a Madoko PHP port, does one exist?


thanks for this, very interesting. I don’t think a PHP port exists but anyway I would be reluctant to replace Grav’s markdown library without knowing exactly what I’m doing and how it affects future functionality and compatibility (which I don’t know), so I think I will try the poor man’s way: write content in Madoko but use comment tags to flag markdown that needs to be removed (or commented out) before copying over to Grav and some other comment syntax to insert markdown that needs to be added for Grav. And then some scripts on top that do the processing. That way the document will contain both types of markdown which may look a little messy but should still be manageable.