chjj/marked — pull request #129 by lepture (2013-03-01 06:21:58+00:00)
Title: renderer feature for customising output

You can customize the result with a customized renderer.

``` js
var renderer = new marked.Renderer();
renderer.blockcode = function(code, lang) {
if (!lang) {
return '

' + code + '

';
}
return highlight(code, lang);
};
renderer.header = function(text, level) {
return '

' + text + '

';
};

var parser = new marked.Parser(options, renderer);
console.log(parser.parse('# h1'));
```

The renderer API:

```
blockcode: function(code, lang)
blockquote: function(text)
blockhtml: function(html)

header: function(text, level)
paragraph: function(text)

hrule: function()

list: function(contents, isOrdered)
listitem: function(text)

table: function(header, body)
tablerow: function(content)
tablecell: function(text, flags)
// flags: {header: false, align: 'center'}
```

I am doing my best to make the renderer API comptable with sundown's renderer.

This is the feature I really need. If marked has, I can drop the c binding sundown of robotskirt.