diff options
author | Shaform <shaform@gmail.com> | 2014-05-27 17:21:34 +0800 |
---|---|---|
committer | Shaform <shaform@gmail.com> | 2014-05-27 17:24:47 +0800 |
commit | 125e804cd517cfc7c0d8fb895db4eeffb44c10cc (patch) | |
tree | 42322cad2a7864d4904467b7ca078f34474019d2 /lib/parse | |
parent | 89ba17de84b6a9c9466bf614a4a82e48d5c48b7a (diff) | |
download | gitbook-125e804cd517cfc7c0d8fb895db4eeffb44c10cc.zip gitbook-125e804cd517cfc7c0d8fb895db4eeffb44c10cc.tar.gz gitbook-125e804cd517cfc7c0d8fb895db4eeffb44c10cc.tar.bz2 |
Add reference links support
This commit resolves #184
Diffstat (limited to 'lib/parse')
-rw-r--r-- | lib/parse/lex.js | 4 | ||||
-rw-r--r-- | lib/parse/page.js | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/parse/lex.js b/lib/parse/lex.js index 17eab69..852d4e0 100644 --- a/lib/parse/lex.js +++ b/lib/parse/lex.js @@ -118,6 +118,10 @@ function lexPage(src) { return sections; }, []) + .map(function(section) { + section.links = nodes.links; + return section; + }) .value(); } diff --git a/lib/parse/page.js b/lib/parse/page.js index 6cfd3ca..688b6c7 100644 --- a/lib/parse/page.js +++ b/lib/parse/page.js @@ -12,10 +12,9 @@ var lnormalize = require('../utils/lang').normalize; // Render a section using our custom renderer function render(section, _options) { // Copy section + var links = section.links; section = _.toArray(section); - - // marked's Render expects this, we don't use it yet - section.links = {}; + section.links = links; // Build options using defaults and our custom renderer var options = _.extend({}, marked.defaults, { |