Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

borked the highlight so I removed

  • Loading branch information...
commit 2878407d80df635668ef27e21641cc0cb2f74be2 1 parent cfd85f5
@brianleroux brianleroux authored
Showing with 5 additions and 13 deletions.
  1. +5 −13 node-code-blog/post.js
View
18 node-code-blog/post.js
@@ -11,12 +11,6 @@ var Post = function(filename){
};
Post.all = function(files) {
- files = files.filter(function (f) {
- if (0 === f.indexOf('.')) {
- return false;
- }
- return true;
- });
return files.map(function(f) {
return new Post(f);
});
@@ -101,17 +95,15 @@ Post.prototype = {
// read in the post text
var p = path.normalize(path.join(__dirname, "..", "posts", this.filename))
, t = fs.readFileSync(p).toString();
-
- // markdown to html
- t = md2html(t);
-
+
// replace the raw code blocks with prettyfied html
t = t.replace(/<code>[^<]+<\/code>/g, function(code) {
- return "<code>" + prettyfy(code.match(/<code>([\s\S]+)<\/code>/)[1]) + "</code>";
+ return "<pre><code>" + prettyfy(code.match(/<code>([\s\S]+)<\/code>/)[1]) + "</code></pre>";
});
- return t;
+ // return markdown to html
+ return md2html(t);
}
};
-exports.Post = Post;
+exports.Post = Post;
Please sign in to comment.
Something went wrong with that request. Please try again.