|
|
#1 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 122
Karma: 81981
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E
|
HTML Replacer - Edit EPUB Content Directly on Your Device
Why This Plugin? You're reading an EPUB and notice issues - missing italics on book titles, typos, weird chapter dividers, or that annoying first-line formatting that CSS tweaks can't catch. But you're in the middle of reading. You don't want to:
This plugin lets you edit EPUBs directly on your device, right in the middle of reading. Apply regex replacements, preview the changes, and continue reading - all without leaving KOReader. Features
Quick Start
Menu Navigation Tap the top menu → Style tweaks → HTML content tweaks (first item in the Style tweaks submenu) From there you'll see:
Example Patterns Code:
-- Fix missing italics on book titles
"The Lord of the Rings" → <i>The Lord of the Rings</i>
-- Fix typos
" teh " → " the "
-- Change chapter dividers
"<hr.->" → <div class="divider">• • •</div>
-- Remove first-line formatting that CSS won't catch
">([A-Z ]{2,50})" → "><span class="makelowercase">%1"
-- Add missing emphasis
'([^']+)' → <em>'%1'</em>
https://github.com/onatbas/htmlreplacer.koplugin Important Notes & Disclaimers 1. Apply Overwrites Original EPUB The "Apply Changes to Original" step permanently replaces your EPUB file. The original is backed up to Code:
htmlreplacer_cache/originals/ Apply also appends the book-specific style tweaks to the original metadata of the replaced book because in my case html tweaks and css tweaks often go hand in hand. 2. Revert Option Available If you're reading a modified EPUB and want to go back, use "Revert to Original" to restore from the backup in the cache folder. Your rules are preserved even after reverting. 3. Don't Start Patterns with Wildcards! Never start regex patterns with wildcards like .* or .- - this can overpower the CPU and hang your device. Always start with explicit matches, emphasize explicitness as much as possible:
4. Use the "Check" Button! Each rule has a "Check" button that shows you all matches and the before/after results. This will help prevent surprises, 0 matches and broken EPUBs. 5. Lua Patterns Are Different from Standard Regex KOReader uses Lua patterns, not PCRE/standard regex:
6. Tested On
Screenshots coming soon... Questions? Ask in this thread! Last edited by lumping-sugar66; Today at 12:48 PM. |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| KOReader: a document reader for PDF, DJVU, EPUB, FB2, HTML, ... (GPLv3) | hawhill | Kindle Developer's Corner | 1289 | 04-07-2025 11:18 AM |
| Edit Book Info directly from PocketBook - epub format & FW6+ only | neil_swann80 | PocketBook Developer's Corner | 7 | 01-12-2024 12:14 PM |
| How to send .epub directly on Kindle and read with KOReader | Alex305 | KOReader | 6 | 05-11-2022 05:33 AM |
| HTML to ePub stripping out Content text | nimblebooks | Conversion | 6 | 02-01-2012 02:50 AM |
| Calibre Recipe HTML content differs from raw html of index.html. | krunk | Calibre | 4 | 09-20-2010 10:48 PM |