Using Markdown and MarkItUp! with Wordpress

Home/Uncategorized/Using Markdown and MarkItUp! with WordPress

While writing my F# posts I had many problems with WordPress’ visual editor. It was constantly mangling my code snippets – and it would be painful to go back through them and correct them by hand. I got fed up with the visual editor so I turned it off. But editing in straight HTML wasn’t as nice as I would like it either.

While I was on hiatus the Stack Overflow site launched. I’ve found it incredibly useful and I keep going back there again and again. One thing I love about their site is the simplified syntax they use: Markdown. I liked it so much that I wanted to use it under the covers for my blog here. I found the Markdown for WordPress and bbPress and WP MarkItUp! plugins and installed them. Markdown for WordPress allows writing posts in Markdown and MarkItUp replaces the editor toolbar with buttons related to Markdown instead of HTML.

Markdown for WordPress worked great. I had no problem editing my posts in Markdown. However, I had a problem configuring MarkItUp. Every time I tried to access the settings page for MarkItUp I received a blang page with the following error: “You do not have sufficient permissions to access this page.” The plugin hadn’t been updated in over a year, so I figured that it was a small incompatibility with WordPress 3. I delved into the markitup_class.php file included with the plugin and found this line:

add_options_page('WP MarkItUp!', 'WP MarkItUp!', 8, 'WP MarkItUp!',
    array(&$this, 'option_page'));

The WordPress [Adding Administration Menu page] describes the 3rd argument as “The capability required for this menu to be displayed to the user.” and further details that, “user levels are deprecated and should not be used here!” Well…that ‘8‘ certianly looks like a user level to me! I replaced the ‘8‘ with the 'manage_options' capability and deactivated then reactivated the plugin. After that…I was still unable to access the plugin settings page.

I looked in the address bar and noticed that the URL ended in “MarkItUp!“. Special characters in URLs can be fishy, so I looked at the 4th argument, the menu_slug, and changed it from 'WP MarkItUp!' to 'markitup'. After going through the deactivation/reactivation procedure one more time I was finally able to access the plugin settings page. The final code looks like this:

add_options_page('WP MarkItUp!', 'WP MarkItUp!', 'manage_options',
    'markitup', array(&$this, 'option_page'));

5 Responses to “Using Markdown and MarkItUp! with WordPress”

written by Edwin On 18 January 2011

Very helpful. Thanks.

written by Louis Marascio On 25 February 2011

Thanks for publishing this. Ran into the exact same problem and this fix worked perfectly. Take care.

written by AppleGrew On 19 April 2011

Thanks. Was really helpful.

written by zourtney On 19 August 2011

That did the trick! Thank you. It seems that 8 months later, this is still an issues :-/

written by Barry On 4 December 2011

Still works and fixes the problem. Thanks!

Leave a Comment