Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How can I use a simplified version of this markdown editor for writing comments on my site?

+4 votes
1,418 views
asked Mar 13, 2015 in Plugins by vdamanafshan
edited Jun 15, 2015 by vdamanafshan

I'm using this version of markdown editor on my site for writing questions and answers. Now I want to use this editor for writing comments, too, but I don't want all features of this editor such as inserting images, quoting, creating lists etc. In other words, I just want these features: 

  1. **bold**
  2. *italic*
  3. [linked word](http://test.com)
  4. `some inline code here`

Also I do not obviously want the editor button anymore for comments. I just want a simple editor for writing comments with above four features, just like StackExchange editor for comments. How can I do this?

Q2A version: 1.6.3
commented May 11, 2015 by vdamanafshan
just bumping!

1 Answer

+1 vote
answered May 11, 2015 by Scott

You might want to look at making your own viewer module: http://question2answer.org/modules.php?module=viewer

You can use the standard plain text editor, then in the viewer module use some simple regular expressions to create the HTML for those styles, e.g.

    preg_replace('/\*\*(.+?)\*\*/', '<b>$1</b>', $content);

If you want buttons for making bold, italic etc like the markdown editor maybe you can take that editor and remove some stuff.

commented May 12, 2015 by vdamanafshan
Thank you very much for your reply, but could you please explain your answer in more detail?
I'm completely new in Q2A.
...