diff options
author | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-04-02 18:40:49 -0700 |
---|---|---|
committer | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-04-02 18:40:53 -0700 |
commit | ecb07468f69fd4a63f074ca0cc1e0e948eeada56 (patch) | |
tree | 2b1aa014d461271915d797e18f7db08e0d6c0c86 /lib/parse/page.js | |
parent | 8fc09e2e05701d3832de2940ae45949a107c5ecb (diff) | |
download | gitbook-ecb07468f69fd4a63f074ca0cc1e0e948eeada56.zip gitbook-ecb07468f69fd4a63f074ca0cc1e0e948eeada56.tar.gz gitbook-ecb07468f69fd4a63f074ca0cc1e0e948eeada56.tar.bz2 |
Resolve relative links to GitHub repo, fixes #6
Useful for linking to blobs and other files …
Diffstat (limited to 'lib/parse/page.js')
-rw-r--r-- | lib/parse/page.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/parse/page.js b/lib/parse/page.js index 505d70f..937d84e 100644 --- a/lib/parse/page.js +++ b/lib/parse/page.js @@ -46,19 +46,22 @@ function sectionType(nodes, idx) { } // Render a section using our custom renderer -function render(section) { +function render(section, _options) { // 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() + renderer: renderer(null, _options) }); return marked.parser(section, options); } -function parsePage(src) { +function parsePage(src, options) { + options = options || {}; + + // Lex file var nodes = marked.lexer(src); return _.chain(splitSections(nodes)) @@ -113,7 +116,7 @@ function parsePage(src) { return { id: id, type: section.type, - content: render(section) + content: render(section, options) }; }) .value(); |