Permalink
Browse files

add gfm code blocks. Closes #71

  • Loading branch information...
1 parent d18737a commit 26e3f936a9f290a755bbb2787a5f1cd250ca221b @tj committed Nov 9, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/api.js
View
@@ -20,6 +20,13 @@ module.exports = function(comments){
.join('\n')
.replace(/^ *#/gm, '')
+ var code = buf.match(/^( {4}[^\n]+\n*)+/gm);
+
+ code.forEach(function(block){
+ var code = block.replace(/^ {4}/gm, '');
+ buf = buf.replace(block, '```js\n' + code.trimRight() + '\n```\n');
+ });
+
return buf;
};

0 comments on commit 26e3f93

Please sign in to comment.