Yes, there are already two plugins (markdown and markdownextra) providing markdown support for Dokuwiki, but there are flaws which make me write my own one.
The problem is that the existing ones just take a script which was originally written for Wordpress. They still contain strange tracking information or so (just to track the code, not the use of it) and several Wordpress-specific code.
They just take a large bunch of text (marked by
<markdown /> tags or a
.md file ending) and convert it to HTML all at once. They do not interact with other plugins or markup, e.g. you cannot use internal links by
[[BlaBla]], or interact with the classes Dokuwiki or templates. At the time I started writing markdowku, it didn't even support TOCs.
You can find its repository here.
There are several incompatibilities this markdown plugin has:
The reason behind these incompatibilities are conceptual differences between Markdown's and Dokuwiki's inner workings. Markdown takes a text as a whole and transforms it into HTML. On the way, it will re-parse blocks (i.e. lists or blockquotes), treating them as if they were standing on their own.
Here is an example for this:
> # Blabla > Blabla
Markdown would see that there's a comment, and then reparse the whole thing with the comment brackets removed, but nested inside the comment, i.e. it would reparse
# Blabla Blabla
and finally produce a blockquote with a headline in it.
Dokuwiki, on the other hand, uses a lexer you can pass tokens (regexes) to be matched. Visually spoken this means that Dokuwiki parses text only sequentially, while Markdown parses text also “vertically”. Overcoming this is difficult and the main reason that nesting is not yet implemented for most formatting.
Markdown is an incomplete markup language. Many projects need something Markdown doesn't offer: Tables. And besides tables, there are other shortcomings some projects didn't want to follow, so they implemented Markdown, but created their own dialect.
There are reasons for each of them, and they all have some nice parts. My goal is to implement some of these dialects, starting with Github flavoured Markdown, and provide a configuration option to choose the dialects you want to activate.