summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-html/lib/dom.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-html/lib/dom.js')
-rw-r--r--packages/gitbook-html/lib/dom.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/gitbook-html/lib/dom.js b/packages/gitbook-html/lib/dom.js
index df4de90..d8f7c84 100644
--- a/packages/gitbook-html/lib/dom.js
+++ b/packages/gitbook-html/lib/dom.js
@@ -23,8 +23,22 @@ function textNode($el) {
}, '');
}
+// Cleanup a dom
+// Remove all divs
+function cleanup($el, $) {
+ $el.find('div').each(function() {
+ var $div = $(this);
+ cleanup($div, $);
+
+ $div.replaceWith($div.html());
+ });
+
+ return $el;
+}
+
module.exports = {
parse: parse,
textNode: textNode,
- root: root
+ root: root,
+ cleanup: cleanup
};