Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
in Plugins by
recategorized by


I planning to create plugin for Q2A for markitup editor, becouse default (ckeditor) is really annoyng with is output messy code and lots of unnesesary features.

A don't have lot experience, i know i need to use editor module but for me it's still dificult to understand.

Maybe someone is already done editor in Q2A and can say how can i implement editor into q2a plugin. Or maybe it's easier to edit ckeditor to work with markitup ?

Thanks for any help with markitup editor.

related to an answer for: WYSIWYG editor for comments too!
bravo ! .. upvote for this effort.. which could be more stable than ckEditor due to  JQuery foundation. fingers crossed   

. although I like many ckEditor features,  even the users on S.O. have trouble it seems..  


I spent a day studying the cke API and just touched the surface.  it's a monster :)

2 Answers

+1 vote
Best answer

You need to download the MarkItUp editor end put it inside a folder, with a name like markitup, and put it inside your plugin folder. Also download jquery and download it into your markitup plugin folder, and then rename the file to jquery.js

I'm not sure if this step is still need, because I think I read somewhere that Q2A already uses jQuery, so it isn't needed do include the file again.

Then create the qa-plugin.php:

if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
    header('Location: ../../');

qa_register_plugin_module('editor','qa-bbcode-markitup.php','qa_bbcode_markitup','BBCode Markitup');

After that, create a file named qa-bbcode-markitup.php:

class qa_bbcode_markitup {
    var $page2plugin;
    var $pdirectory;

    function load_module($pdirectory, $page2plugin) {
        $this->pdirectory = $pdirectory;
        $this->page2plugin = $page2plugin;

    function calc_quality($content, $format) {
        if($format == 'bbcode') return 1.0;
        elseif($format == 'html') return 0.0;
        elseif($format == '') return 0.8;
        else return 0;

        function get_field(&$qa_content, $content, $format, $fieldname, $rows, $autofocus) {
        if ($autofocus)
            $qa_content['focusid'] = $fieldname;

        $textfield = '
<script type="text/javascript" src="'.$this->page2plugin.'jquery.js"></script>
<script type="text/javascript" src="'.$this->page2plugin.'markitup/jquery.markitup.js"></script>
<script type="text/javascript" src="'.$this->page2plugin.'markitup/sets/bbcode/set.js"></script>
<link rel="stylesheet" type="text/css" href="'.$this->page2plugin.'markitup/skins/markitup/style.css" />
<link rel="stylesheet" type="text/css" href="'.$this->page2plugin.'markitup/sets/default/style.css" />

<script language="javascript">
$(document).ready(function()    {
<textarea class="markItUp" name="'.$fieldname.'" id="'.$fieldname.'" cols="80" rows="'.$rows.'">'.$content.'</textarea>';    

        return array(
            'type' => 'custom',
            'html' => $textfield,

    function read_post($fieldname) {
        $text = qa_post_text($fieldname);
        return array(
            'format' => 'bbcode',
            'content' => $text);


Q2A 1.4 beta 1 includes jQuery on every page, so you don't need to include that as part of this editor.
@Another one Sent PM to you.
similar error on qa-app-format.php
Could you release it as a plugin scorch?
Unfortunately I can't because the plugin isn't mine, and Another One was just an exception. I don't think the plugin onwer will open more exceptios. Sorry.

Btw, what you have to do is create a viewer module to render BBCode. You can find a good and simple free parser here:
And info about viewer module:
+2 votes
I have a Markdown editor plugin that I'm happy to share. It uses the WMD editor as provided by Stack Overflow (with a few bug fixes in place) and Showdown for the live preview.

I'm currently working on setting up a blog so I can post stuff like this, I'll keep you posted.
Great ! waiting for blog :)
Hi, can you share your markdown plugin disgruntledgoat?
Thanks in advance
Yes, I will do once I have fixed a couple of small bugs and tested it in a new installation :)
Thanks ;D. I will patiently waiting =)
I just registered on your pokemondb.net website to see how the markdown editor works. It seems it works fine :). I need markdown since my site using latex a lot to write math symbols. The showdown helps to have a live preview of the messy latex.
Any chance that it is available for download now DisgruntledGoat?
edited by