Markdown experiment

in discussion
Subscribe to Markdown experiment 8 posts, 6 voices

Jesse Andrews Admin

I've been exploring how to improve the markup situation of the site. I kinda like StackOverflow's editor - with inline previewing. They previously reverse engineered the JavaScript markdown editor for which they only had obfuscated code. They have a C# implementation for the server side they just open source called MarkdownSharp. In the comments someone asked:
Why not just have 1 JS version and call into it from C#?
Which made me realize I should be doing that for So I created a simple node.js server to prototype running showdown on the server side. The code is very simplistic right now, but you can test it at The code I'm using right now is from tstone's jquery-markedit repo.
var sys = require('sys'), 
    parser = require('./querystring-parse'),
    sh = require('./showdown'),
    http = require('http');

var MarkEditShowDown = sh.converter;

http.createServer(function (req, res) {
  if (req.method == 'GET') {
    res.sendHeader(200, {'Content-Type': 'text/html'});
<input /></form>"); res.finish(); } else { var body = ""; req.addListener("body", function(chunk) { body += chunk; }); req.addListener("complete", function() { res.sendHeader(200, {'Content-Type': 'text/html'}); res.sendBody(MarkEditShowDown.makeHtml(parser.parse(body)['text'])); res.finish(); }); } }).listen(8000); sys.puts('Server running at');
Marti Scriptwright

Looks interesting especially on the abstraction of links... although, in general, it's beginning to be a drain on mental resources that no standard besides HTML markup has been employed across the world wide web for formatting and linkage. (GitHub has one way which has changed over the last few months, Goo has another, etc...).

Jesse Andrews Admin

I'm going to use github's example result to make sure our markdown is the same as theirs (except the github specific stuff). It isn't yet - emails aren't linked and the first "rose are red violets are blue" doesn't render correctly.

Joshua McKenty Scriptwright

I think it's a great idea - but we won't really be able to tell until it works in these reply boxes, right?

Yansky Scriptwright

Jesse, you might find these blog posts interesting:

Tim Smart Scriptwright

Markdown is awesome. For a concept run, try this:

Also, nice to see the use of Node.js :D You might want to check out the latest API additions and changes though.

sizzlemctwizzle Scriptwright

Do you think we can have markdown implemented in the forum anytime soon? I'd really be great.

Tim Smart Scriptwright

A quick update. I have implemented a DOM -> Markdown parser in ecmascript. You can take a look here (Example script that uses it USO, meet Markdown)

If you find a bug all my code is hosted at , where you can file an issue report or patch.