summaryrefslogtreecommitdiffstats
path: root/lib/parse/renderer.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-03-31 12:16:16 -0700
committerSamy Pessé <samypesse@gmail.com>2014-03-31 12:16:16 -0700
commit77a4c1042c7c13327641fb057c3c203cbf868782 (patch)
treeacffe873bdf71e8dc89e973bc41ef5a30be63533 /lib/parse/renderer.js
parent6df59745b1e32535bc529f97d3c752afac50095d (diff)
parent89593f46ab0c7dddab8414c5da55f0faeb3e61a4 (diff)
downloadgitbook-77a4c1042c7c13327641fb057c3c203cbf868782.zip
gitbook-77a4c1042c7c13327641fb057c3c203cbf868782.tar.gz
gitbook-77a4c1042c7c13327641fb057c3c203cbf868782.tar.bz2
Merge branch 'master' of https://github.com/GitbookIO/gitbook
Diffstat (limited to 'lib/parse/renderer.js')
-rw-r--r--lib/parse/renderer.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/parse/renderer.js b/lib/parse/renderer.js
new file mode 100644
index 0000000..66aad46
--- /dev/null
+++ b/lib/parse/renderer.js
@@ -0,0 +1,27 @@
+var inherits = require('util').inherits;
+
+var marked = require('marked');
+
+
+function GitBookRenderer(options) {
+ if(!(this instanceof GitBookRenderer)) {
+ return new GitBookRenderer(options);
+ }
+ GitBookRenderer.super_.call(this, options);
+}
+inherits(GitBookRenderer, marked.Renderer);
+
+
+GitBookRenderer.prototype.link = function(href, title, text) {
+ // Replace .md extensions by .html
+ return GitBookRenderer.super_.prototype.link.call(
+ this,
+ href.replace(/\.md$/, '.html'),
+ title,
+ text
+ );
+};
+
+
+// Exports
+module.exports = GitBookRenderer;