mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 16:15:22 +00:00
28 lines
600 B
JavaScript
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;
|