summaryrefslogtreecommitdiffstats
path: root/lib/parse/renderer.js
blob: 66aad46b922cabaeb71a06dc3f9cd8f798a17040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;