diff options
Diffstat (limited to 'lib/output/base.js')
-rw-r--r-- | lib/output/base.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/output/base.js b/lib/output/base.js index d22fda1..6678bb0 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -130,10 +130,18 @@ Output.prototype.finish = function() { // Resolve an HTML link Output.prototype.onRelativeLink = function(currentPage, href) { - var to = this.book.getPage(href); + var to = currentPage.followPage(href); // Replace by an .html link - if (to) href = this.outputUrl(to.path); + if (to) { + href = to.path; + + // Recalcul as relative link + href = currentPage.relative(href); + + // Replace .md by .html + href = this.outputUrl(href); + } return href; }; |