[index] [home]

Tweet

Converting my Markdown-pages to MediaWiki-format

This page serves as a mental note, when converting Markdown-pages to MediaWiki format, for use in the Electriki IRC-wiki.

Example:

Conversion

Install Pandoc, and convert your page:

    pandoc -f markdown_strict My_Page.markdown -t mediawiki -o My_Page.mediawiki

Then, create a new MediaWiki-page, paste this generated ".mediawiki" file into the form, and sumbit the form.

Adornment for use in Electriki

Add a heading at the top of the page:

    __NOEDITSECTION__
    [[category:projects done]]

    <blockquote>
    ''NOTE: this page is copied here because this is (sort of) electronics-related - ''
    ''the original page is [http://home.mircad.nl/md/MyPage.html here]. ''
    ''Some formatting-details (e.g. underscores) may be malformed in this copy.'' 
    </blockquote>

(Another common project-category is "!electronics" for non-electronics related stuff.)

Upload refered-to files

On the left of the page, choose "Upload file" ("Upload multiple files" doesn't seem to work at the time of writing).

(MediaWiki's upload-form seems to warn about changed filename (e.g. that it will convert multiple underscores into a single one), but uploaded files can magically still be refered to from the corresponding page, even if it used references containing multiple underscores in filenames.

In other words, I think it's safe to ignore these "filename changed" warnings during upload.

Caveat

I didn't really look into this, but Markdown code-blocks (using "<pre>...</pre>" directives with escaped special characters like "&quot;" instead of quotes, when rendered to HTML) are converted by Pandoc into exactly that - literal "<pre>...</pre>" blocks with escaped special chars.

That means that the appearance of code-blocks in generated MediaWiki pages is fixed at the time of conversion, and e.g. MediaWiki's "<syntaxhighlight lang=...>...</syntaxhighlight>" tags can not be used easily. Oh well.


Delivered to you by Vim, GNU Make, MultiMarkdown, bozohttpd, NetBSD, and 1 human.