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

I have updated my Markdown editor plugin to fix the few bugs that were present in the Chrome browser and a few more I found with the preview. This now uses the PageDown script that Stack Overflow uses so it's very stable. Tested with both 1.4 and 1.5.

https://github.com/svivian/q2a-markdown-editor - click ZIP in the top left to download package, or use Git so you can keep it updated easily.

Update 14/06/2012 - version 2.2 with some new features:

  • Uses the plugin update check.
  • Links open in a new window, if the option is set in Q2A.
  • CSS is added inline, to save you having to add it to the stylesheet. There is an option to not use inline CSS, if you want to use the stylesheet (which is more efficient).
  • An option that converts to plaintext when turning an answer into a comment.
  • Integration of Syntax Highlighting (same component as NoahY's version)

 

by
@princeps I have no plans to implement mathjax in the Markdown editor, so you'll have to do that yourself, sorry. If you don't know how to do that then perhaps post a new question here and someone may help you.
by
@scott
Sorry for repeated second request. Can you please incorporate image upload feature?
by
In case anyone interested, this is how to enable mathjax preview interactivity.
Add the following function to Markdown.Editor.js:

             util.addEvent(panels.input, "keyup", function () {
                var previewID=this.id.replace("input","preview");
                MathJax.Hub.Queue(["Typeset", MathJax.Hub, previewID]);
            });
by
the linebreak problems with the embed conflict can be resolved by turning off lightbox within the embed plugin.

4 Answers

+5 votes
by
edited by

Great :) just wondering why not include the CSS in a layer?  Much easier than having people copy it over, and then you can also specify which requests to add the css to.

Also, Gideon gave a solution to the first line indenting problem, which is to do:

        $html=$_POST[$fieldname];

rather than

        $html=qa_post_text($fieldname);

Otherwise, seems to work great, even for comments.  I'm updating my version with the syntax highlighting to match the changes, not sure if you're interested in merging, but it's here:

https://github.com/NoahY/q2a-markdown-editor

by
Regarding CSS, maybe I could make it an option. I've done it like that because it's better to serve all CSS from one file than from several files or inline to a page. Since it would be on every question page it makes sense to put it in the stylesheet so the user only downloads it once, not on every page load.

I'll take a look at the syntax highlighting. I thought that was a separate plugin though, not a mod of the editor itself.
EDIT: from the look of it, it's just a Javascript that does the highlight. What changes have you made to the PHP code? I may be able to integrate the highlighter in to mine quite easily.
by
Ah, that makes sense that the css would be cached.  Still, too bad to have to copy and paste it.

no changes to the php were required, as far as I remember, just added a layer and admin module - the former does a timeout after every keypress to reformat the text, and on document load; the latter has options for highlight css.
by
@ Noahy I am getting some problem with your markdown plugin :
example if i write :
i do'nt need

in markdown editor after saving post it shows :
i do/'nt need

it add backslash in text after saving.
please take a look in this matter.
by
You can add the CSS only to editor pages. So that in 98% it won't affect the page speed, and editor would be slower anyway. I believe users will accept this.
0 votes
by

Hi Scott, I found a markdown editor with live preview (using jquery), maybe you like to implement this in one of the future versions?

http://oscargodson.github.com/EpicEditor/

by
What is the advantage of this version? My current version does everything that does (except full screen). Does that one have a toolbar? I couldn't see any options for it.
by
ah okay, I am not using your markdown editor but remembered that you are developing/maintaining this plugin, so I thought this would interest you regarding the live-preview-thing...
by
Is this site yours? http://www.gute-mathe-fragen.de/ask
I think this editor is also nice.Since the live previewing,and auto saving,or other advantage I haven't find?
If we can add other function in the toolbar,it maybe better.
0 votes
by

 

Today I find a way how to easily implement image upload service together with Markdown editor. The solution is universal and can be used with any text editor. 

Here is a link to short tutorial I made about how to implement file uploading. (File uploading is made by using external service)

http://blog.inventic.eu/2012/11/q2a-markdown-editor-with-file-upload/

0 votes
by

Hi scott, i was seeking lately a solution fo image uploading and found the following  that might help in the futur versions 
http://jordanarseno.com/blog/8/uploading-images-with-wmd-editor

Thnks !!

...