JQuery / JS Markdown plugin?

I am writing a chat application, and I would like to add some simple features when users use markup to influence text formatting, such as bold or italics. I assume this will be similar to how it is done in Google Talk or StackOverflow. Does jQuery have plugins for this?

+5
source share
3 answers

stackoverflow uses the WMD editor. You can use the WMD editor code. This is written by javascript.

verify

http://blog.stackoverflow.com/2009/01/wmd-editor-reverse-engineered/

For WMD for HTML you can use ShowDown javascript .

Github ( showdown.js)

http://github.com/derobins/wmd

var text = "Markdown *rocks*.";
var converter = new Attacklab.showdown.converter();
var html = converter.makeHtml(text);
alert(html);
+12

Showdown jQuery . jQuery:

// See http://mathiasbynens.be/notes/showdown-javascript-jquery for a plain JavaScript version as well
$(function() {
 // When using more than one `textarea` on your page, change the following line to match the one you’re after
 var $textarea = $('textarea'),
     $preview = $('<div id="preview" />').insertAfter($textarea),
     converter = new Showdown.converter();
 $textarea.keyup(function() {
  $preview.html(converter.makeHtml($textarea.val()));
 }).trigger('keyup');
});
+6

FWIW, jQuery Markdown, Showdown. , Markdown, - .

Markdown . Transclusion {{include-this}}, , Markdown .

: $(#mydiv).markdown('mybase/', 'mydir/mydoc.markdown');

Please feel free to download and use without restrictions at http://plugins.jquery.com/project/markdown .

+1
source

All Articles