-
Notifications
You must be signed in to change notification settings - Fork 14
How EpubEditor works.
dteviot edited this page Aug 16, 2026
·
1 revision
An epub is a zip file, containing a bunch of HTML files.
What EpubEditor does is,
- Open the epub,
- Take each HTML file, and pass it to the EpubEditor Script. (the HTML is passed as DOM, called "dom") to the script
- Script can modify the DOM and return true, if the HTML is changed. Or false if not changed.
- If DOM is changed, EpubEditor replaces the HTML file in the zip (epub) with the changed file.
A simple EpubEditor script (that removes all <button> elements from a page)
let changed = false;
for(let p of [...dom.querySelectorAll("button")]) {
p.remove();
changed = true;
}
return changed;