Permalink
Browse files

Add `code` extension that generate <pre><code class="$lang">...</code…

…></pre> markup
  • Loading branch information...
1 parent efa5ac3 commit 1d25ad672e41aaafa8732c1a3f72cefabc7484fa @arikon arikon committed Oct 10, 2012
Showing with 22 additions and 0 deletions.
  1. +22 −0 lib/extensions/code.js
View
@@ -0,0 +1,22 @@
+var U = require('./util');
+
+exports.astToBemjson = function(c, p) {
+
+ return {
+ tag: 'pre',
+ content: {
+ tag: 'code',
+ cls: p,
+ content: U.htmlEscape(c)
+ }
+ };
+
+};
+
+exports.astToHtml = function(c, p) {
+
+ return '<pre><code class="' + p + '">' +
+ U.htmlEscape(c) +
+ '</code></pre>';
+
+};

0 comments on commit 1d25ad6

Please sign in to comment.