Markdown with Yada Wiki and Jetpack

In the office we have recently decide to migrate our team wiki to WordPress and Yada Wiki has been selected.

The team is also quite comfortable with Markdown, even if not everybody is ready to adopt it as the main editor, so I struggled a bit to find a solution, until I stumbled upon Jetpack.

I installed Jetpack directly from the WordPress admin console (which I just love!), but I had to connect to the server console to force Jetpack into developer mode, which is required if your server isn’t going to be publicly accessible.
To do so you need to open your wp-config.php, search for define('WP_DEBUG', false); and add the following line

add_filter( 'jetpack_development_mode', '__return_true' );

That brings you one step forward, but after enabling the Markdown feature in the Jetpack installation page you will be able to use Markdown in pages and posts only: your wiki pages will not be affected. That’s because Yada Wiki uses it’s own custom content type to distinguish wiki pages from other contents, which is a good thing.
So you need to extend the Markdown support to this additional content type, which is easily achievable adding the following lines at the very end of the functions.php file of your theme of choice:

add_action('init', 'my_custom_init');
function my_custom_init() {
    add_post_type_support( 'yada_wiki', 'wpcom-markdown' );
}

Now your wiki editors can decide to use the WYSIWYG editor or switch to the text editor and start typing their contents in Markdown syntax and preview their edits by just hitting the Preview button.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s