Files
gitbook/lib/parse/renderer.js
T
2014-03-31 12:09:28 -07:00

28 lines
600 B
JavaScript

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;