View Single Post
Old 12-04-2025, 03:51 PM   #11
lumping-sugar66
Zealot
lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.lumping-sugar66 knows better than to ask about the Gravitic Imploder Lance.
 
lumping-sugar66's Avatar
 
Posts: 132
Karma: 87635
Join Date: Oct 2023
Location: Ontario, Canada
Device: Kobo Aura Edition 2, Kobo Clara 2E, Kobo Libra 2
HTML Replacer Plugin for KOReader - A Walkthrough (Part 2 - New Features: Footnotes & Shortcuts)

Second Functionality: Footnote Rules

This is a newly added feature - you're now able to add footnotes to the HTML with ease.

Starting fresh, instead of creating a replacement rule, I'm going to add a footnote rule. It looks like this:



It allows me to add:
  • The pattern to match
  • The footnote delimiter/indicator (the superscript marker you see)
  • What you want the footnote text to be
  • How frequently you want this footnote to appear

In my settings, I usually use 10,000 to 20,000 characters - this means the footnote gets introduced to patterns that match every few pages. Here I'm going to set it at 5,000 so that every 5,000 characters, an occurrence of "new terra" will get a footnote.

Otherwise, if you're adding this to a word that appears too frequently, you may end up polluting your book with the same footnote over and over again.

The description is what's visible in the menu. You don't need to set that, but it's helpful if you want to track rules - it'll default to the pattern if you don't specify one.



[HR][/HR]

Seeing Footnotes in Action

After adding the rule, I'm going to hit Reload with Replacements:



After the book loads, this is what it looks like:



Now it's important to note that the tags are introduced - a <sup> element is used for this - but it's not styled. It's up to you to style the HTML elements the way you want.

Here's the inserted HTML:



Here's how it looks with a custom footnote style applied:



And for me, it simply looks like this:



Now, as before, I need to go in and hit Apply Changes to Original before the changes are properly applied to my original file:



[HR][/HR]

Shortcuts

The plugin allows you to add replacement rules and footnote rules without going into the menu. You can easily just highlight a portion of the text:



Then select one of the options introduced with this plugin. You'll see Footnote Rule and Replacement Rule here. Press either of them and it will open the menu for adding a rule with pre-filled information:



You still need to go into the menu and hit Reload with Replacements before changes are applied properly to your book. But I find that I usually read a few pages, add all my rules, and then do a big batch of rule executions. Then I apply my EPUB that way.

So it's not as dynamic as Style Tweaks - this changes your EPUB completely - but it's still very useful if you want to add footnotes or simple replacements to your book as you go.

[HR][/HR]

Safety Net: Original Books are Always Backed Up

In any case where things have gone wrong, you'll always find your original books cached under this path:



These are unmodified original versions of the EPUB files that you can either manually grab, or as shown from the menu, you can just select Revert to Original.

[HR][/HR]


Summary

The HTML Replacer plugin gives you powerful control over your EPUB content:
  • Use replacement rules to modify text or HTML elements with regex patterns
  • Add contextual footnotes that appear at controlled intervals
  • Preview changes before making them permanent
  • Always have a backup to revert to if needed
  • Use shortcuts to quickly add rules while reading

It's perfect for fixing formatting issues, adding contextual information, or customizing your reading experience.
lumping-sugar66 is offline   Reply With Quote