diff options
author | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-03-31 12:09:28 -0700 |
---|---|---|
committer | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-03-31 12:09:28 -0700 |
commit | 89593f46ab0c7dddab8414c5da55f0faeb3e61a4 (patch) | |
tree | 9649f634aebcd644b96225a8f2e596fe216ed180 /lib/parse/page.js | |
parent | 1d321207b045f7f9c34267fa4ce86fb41a1172a4 (diff) | |
download | gitbook-89593f46ab0c7dddab8414c5da55f0faeb3e61a4.zip gitbook-89593f46ab0c7dddab8414c5da55f0faeb3e61a4.tar.gz gitbook-89593f46ab0c7dddab8414c5da55f0faeb3e61a4.tar.bz2 |
Normalize .md links to .html when rendering pages
Diffstat (limited to 'lib/parse/page.js')
-rw-r--r-- | lib/parse/page.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/parse/page.js b/lib/parse/page.js index 047f3e4..b1e4332 100644 --- a/lib/parse/page.js +++ b/lib/parse/page.js @@ -1,6 +1,8 @@ var _ = require('lodash'); var marked = require('marked'); +var renderer = require('./renderer'); + // Split a page up into sections (lesson, exercises, ...) function splitSections(nodes) { @@ -49,10 +51,15 @@ function parsePage(src) { // marked's Render expects this, we don't use it yet section.links = {}; + // Build options using defaults and our custom renderer + var options = _.extend({}, marked.defaults, { + renderer: renderer() + }); + // Render normal pages return { type: section.type, - content: marked.parser(section) + content: marked.parser(section, options) }; }) .value(); |