mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 19:06:31 +00:00
Generate a unique Id for each section
This commit is contained in:
@@ -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)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user