From a8e0de86e94686757f809d1e987e2e025ab8d35d Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Mon, 31 Mar 2014 15:03:04 -0700 Subject: [PATCH] Generate a unique Id for each section --- lib/parse/page.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/parse/page.js b/lib/parse/page.js index 7c188eb31..6481e656e 100644 --- a/lib/parse/page.js +++ b/lib/parse/page.js @@ -56,6 +56,9 @@ function parsePage(src) { return section; }) .map(function(section) { + // Generate a uniqueId to identify this section in our code + var id = _.uniqueId('gitbook_'); + // Transform given type if(section.type === 'exercise') { var nonCodeNodes = _.reject(section, { @@ -67,6 +70,7 @@ function parsePage(src) { }); return { + id: id, type: section.type, content: render(nonCodeNodes), code: { @@ -79,6 +83,7 @@ function parsePage(src) { // Render normal pages return { + id: id, type: section.type, content: render(section) };