Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add gfm code blocks. Closes #71

  • Loading branch information...
commit 26e3f936a9f290a755bbb2787a5f1cd250ca221b 1 parent d18737a
@tj authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/api.js
View
7 lib/api.js
@@ -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;
};
Please sign in to comment.
Something went wrong with that request. Please try again.