Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+24 votes
14.5k views
in Plugins by
edited by

UPDATE: check this thread for future updates.

I've been working on this on and off (mostly off), for a few months now. Finally I got round to finishing it to a reasonable state! It's a Markdown editor plugin, which has several advantages over CKeditor, the default in Q2A.

More details on the plugin, instructions and files to download are available here: http://codelair.co.uk/2011/markdown-editor-plugin-q2a/

It's licensed under GPL so it's free and open source. There are some minor bugs that I haven't managed to fix just yet, so if anyone manages to fix them please let me know and I will update it. Also, I have copied the files direct from my Q2A site where it's been in use for the last little while, so if there turns out to be any site-specific code that I left in there let me know ;)

I'd love to know what you think, and any suggestions for improvements! Just post an answer here.

by
edited by
Dear @Scott have you tried to combine your plugin with MathJax? I mean editor preview generates also mathjax fonts as typing. Thanks
by
I haven't tested the new plugin  yet but I had a previous one that was quite nice. I hope in the new updated plugin if you can allow mathjax to be updated during preview mode and to allow its special characters such as backslash, \, single qoute', underscore _.
by
Just tested this on my QA site. Works nicely and just what I wanted! Very StackOverflow-esque. Thanks!
by
Thanks for your work! It works well on my site. Anyway, I want to know how to make it support in comment? is this simple?

8 Answers

+2 votes
by
Wow, Markdown plugin really has sense for me! Definitely I test it and I'm interested in father development.

I think we need simple WYSIWYG editor  with markdown like one at StackOverflow.
0 votes
by

I have problem

by
version
1.4
1.4.1
by
You should read instructions before installing plugin. (2. step - Copy the CSS from sample.css to the bottom of your theme’s current stylesheet.)
by
Yep, that's what it looks like for me if I turn off CSS. So make sure to copy the CSS from sample.css to your qa-styles.css.
by
Oops, Sorry =[
thank you:)
0 votes
by
"Open entered links in a new window:" feature doesn't work with Markdown editor.
by
What do you mean? Where is this option, in Q2A somewhere?
by
admin/viewing >> "Open entered links in a new window:"
by
OK I will take a look at this and see how to detect this option. The links currently get put through a native Q2A function so I thought that would take care of everything, but maybe not.
by
a temporary solution is to open:
qa-plugin\markdown-editor\inc.markdown.php

navigate to line 608 that contains:
$result .= ">$link_text</a>";

and replace it with:
$result .= "target=\"_blank\">$link_text</a>";

Hope this helps.
by
Thanks, it works :)
+1 vote
by
I left some comments on the project page, but I'll cross-post them here too.  Great plugin!  Thanks alot.  Much preferred over the wysiwyg editor.

Just one complaint, that 'top' should be changed to 'window' in the javascript, otherwise it breaks if q2a is running in an iframe.
by
edited by
I've replace text in the file markdown.min.js
...addEvent(top,"load"... to
...addEvent(windows,"load"... and it works fine in frame

UPD: well I'm also replace some other "top" to "window" in files markdown.min.js and in wmd.js
0 votes
by
One complaint I have with the markdown js (not your plugin) is that when you quote text, it truncates it all, making it quite difficult to read.  Today I managed to "fix" this, by removing the following command from markdown.min.js:

    f.wrap(a,d.wmd_env.lineLength-2),

or from wmd.js:

    command.wrap(chunk, wmd.wmd_env.lineLength - 2);

Now it just adds quote marks to the beginning, as seems reasonable.
+1 vote
by
Thanks DisgruntledGoat for this wonderful plugin.

I saw this plugin working on your site, Can I use this pulgin for Q2A 1.4.2?

also will it show preview box? similar to what I can see on your site.

Is this plugin works on the custom created pages?
by
Yes, it works fine on 1.4 and it comes with the preview box. Make sure you copy the CSS from sample.css to your stylesheet for everything to display properly.
It doesn't work on custom pages, they just use a plain text box. I don't think there is any option to use a different editor, not even the WYSIWYG one.
by
Thanks! what changes does it make to database?
by
It doesn't make any changes at all. New posts made with the editor will have the type "markdown" in the database. There is a SQL query in the readme on github ( https://github.com/svivian/q2a-markdown-editor ) that will change the type of all old posts to markdown if you want that. It's not part of the plugin because it could break older posts.
by
Thanks again!
+2 votes
by

 

Thanks for your plugin. That's very simple & beautiful for q2a.
But do you have a plan to add a image upload function for this editor ?
+1 vote
by
I am using it at http://qa.libreprogramming.org/ It works nice but image upload feature is needed. It is a show stopper at least for my site where we need to share screenshots frequently.
...