
Major Mode for Reading EPUBs in Emacs - JNRowe
https://github.com/wasamasa/nov.el
======
qwerty456127
That's a pity the FB2 format is not nearly as popular as EPUB is. It's a
single-file pure tidy (I mean a simple, intuitive, bloat-free, well-documented
schema) XML with purely semantic layout and no formatting. It's a pleasure to
write code processing it. The user/app/device is the only to decide how to
view it (neither pages nor fonts are specified). Isn't this lovely?

~~~
oefrha
EPUB's zip archive may encapsulate images and fonts. How do you achieve that
with a single XML file? I guess it has a reduced feature set?

~~~
thomascgalvin
I wrote and use an editor similar to Scrivener that allows the user to edit in
Markdown, but saves the project as XML. Images are saved as nodes with a
mimetype and a Base64-encoded byte array, and referenced in the document with
a UUID.

HTML also allows you to specify an image inline using Base64 encoding;
soemthing like

    
    
        <img src="data:image/png;base64, fhfhfhfh...">
    

I don't know what FB2 does, but it's definitely a solvable problem.

~~~
rnhmjoj
Reading the wikipedia article[1] this is exactly what it does.

[1]:
[https://en.wikipedia.org/wiki/FictionBook#Differences_from_o...](https://en.wikipedia.org/wiki/FictionBook#Differences_from_other_ebook_formats)

------
ashton314
Shameless plug for a personal project:

[https://github.com/ashton314/homebrew-
mm](https://github.com/ashton314/homebrew-mm)

This is really just a one-liner I put in a shell script to pass things to
Pandoc so I could read them like a man page in my terminal.

Love the Emacs lib though. The more emacs I my life the better. :)

~~~
bambataa
A screenshot would be great. I'm not sure what the output would look like and
therefore if it's something worth trying. Though as you say it's only a one
liner...

~~~
ashton314
Great advice! Thanks!

------
SanchoPanda
This is really clean. Ugly option for for non-emacs plebs like me:

unzip -qc "$1" " _._ htm*" | w3m -T text/html -dump -cols 120

~~~
Koshkin
The UNIX way.

------
donio
[https://github.com/bddean/emacs-ereader](https://github.com/bddean/emacs-
ereader) is another one. Similar features, the biggest difference is that nov
shows a chapter at a time while ereader renders the entire document at once
which allows doing isearch over the whole thing.

Both of these take advantage of the shr HTML renderer built into Emacs which
in turn uses libxml2 to do the heavy lifting.

~~~
OskarS
From the screenshot, my one big complaint is that it's typeset ragged right
instead of flush right (which is, generally, how books and most ebook readers
do it), but I suppose that's just a CSS fix, then?

~~~
rcthompson
If you scroll down, the README tells you how to make it flush right:
[https://github.com/wasamasa/nov.el#rendering](https://github.com/wasamasa/nov.el#rendering)

~~~
OskarS
Ah, excellent :) that looks much nicer!

------
catalogia
Nov is my primary ereader these days, particularly since the read-aloud
package compliments it so well. If I had one complaint, it's that I wish it
supported concatenating all chapters of a book into one single buffer.

------
michaelmrose
I really like that this by default remembers your place in the book. Between
Nov.el, pdf-tools, pdf-view-restore, and the fact that most non pdf files
convert pretty easily to epub I think one can now use emacs as reading
software pretty easily and with far less effort.

The bindings are even similar save for o for outline in pdf-tools and t for
table of contents.

One suggestion would be a function to search the entire document since in
buffer search will only search the current chapter.

Really awesome progress.

------
hesk
Now, if only I could get Emacs running on my iPad mini which is my primary
e-reader.

~~~
brians
It runs fine in ish.app

~~~
mark_l_watson
I can’t find ish.app in the iOS store. Please post publisher and further
details.

~~~
jefftk
Looks like it's [https://ish.app](https://ish.app)

------
NilsIRL
I think you can also do that using DocView[0] and the mupdf backend.

[0]:
[https://www.gnu.org/software/emacs/manual/html_node/emacs/Do...](https://www.gnu.org/software/emacs/manual/html_node/emacs/Document-
View.html)

------
timonoko
"Keybinds can be viewed with F1-m". This information should be in the first
chapter of README. :-/

~~~
monsieurbanana
F1-m translates to "C-h m", which is the standard Emacs command to show
information about the current major-mode. It's not specific to nov.el.

~~~
timonoko
I did not know that. And I have been using Emacs since 1984. I use "M-X
apropos".

~~~
sls
C-h ? will show you help on help, among them:

C-h a - apropos

C-h k <key sequence> \- detailed docs on the command run by key sequence

C-h m - docs on current minor modes and major mode

C-h w <command> \- what keystrokes will run command

There's a lot more as well.

~~~
timonoko
C-h is backspace and also "move cursor left" on many ancient video terminals.
So it was always remapped.

------
burtonator
I've been heads down looking at implementing EPUB for Polar and there's no way
this could work reliably in Emacs. If so I'd be very very very impressed if
Emacs could pull it off but I'd bet money that it can't.

I think a good 80% of them could work but you don't want to be halfway done an
EPUB only to find out that code highlights weren't being rendered or that
rending is halfway broken for some small percentage of the document.

------
jangid
From where do you guys purchase or download (free) EPUBS? I wanted Christensen
books and didn't find any. Either they are tied to Kindle or Noob.

~~~
michaelmrose
From the same people that run sci hub. Please remember that authors need to
eat too though. If you have money you should support them by buying their
books or they may write fewer of them for you to enjoy.

~~~
sadfklsjlkjwt
This doesn't excuse DRM. Personally I don't read ebooks because (1) I won't
accept DRM, (2) I won't pirate. Instead I buy a few books in dead tree format
but mainly lots of authors are losing out.

~~~
michaelmrose
You could buy the dead tree and pirate the ebook supporting the author but not
drm.

------
michaelmrose
It would be nice to have an interface to calibre search of your ebook
metadata. This can be done by wrapping calibredb.

Example use case. Run M-x calibre-search , prompt appears type title:space
tags:scifi search is populated with the titles and metadata of matching books
and you type to narrow hit enter book opens.

Also open-last-book and open-recent-books. I could probably add this to my
existing wrapper.

~~~
vcxy
My solution to this has been to export the library as a bibtex file, which is
a built in feature of Calibre, and then use ivy-bibtex (could just as easily
use helm-bibtex) to search the library. You need to make sure the file path is
part of your bibtex export, but this is easily done. Also make sure you export
tags.

~~~
michaelmrose
Sounds kind of manual compared to what I do now which is wrap calibredb in a
script and narrow if needed via rofi.

[https://github.com/davatorium/rofi](https://github.com/davatorium/rofi)

Presumably would be about as easy to do in elisp.

A call to calibredb in a library of thousands of books on ssd is only 1/3 ->
1/2 a second

~~~
vcxy
It is a little more manual, but I think the end result is a little faster
during use. This half second delay you mention doesn't happen with my library
of over a thousand books. If I had something more automatic, I'd still want to
be able to use bibtex. I like having the same interface for reading and
citing, as well as the same for both reading books and reading papers.

I bet there is a command line way to export a bibtex library, so it could be
automated in elisp. It takes seconds though, and I only do it a few times a
month. Doesn't matter though, I settled on this workflow because I was already
using bibtex regularly for papers. Probably makes less sense if you aren't
already happy with bibtex.

------
sriacha
Does anyone know of a tool like pdf-tools but for annotating epub?

Ideally I have an epub that I read on my kobo ereader. Afterwards I have a
number of annotations (highlights) that I have listed in plain text.

I would like to be have the epub and the highlights side by side and be able
to snap directly to the highlights position within the epub in order to take
further notes.

~~~
BeetleB
For annotating, you can try org-noter:

[https://github.com/weirdNox/org-noter](https://github.com/weirdNox/org-noter)

If you want to get your annotations into org mode/emacs, look at this guy's
work:

[https://beepb00p.xyz/orger.html](https://beepb00p.xyz/orger.html)

I haven't yet tried it, but I think he does something similar.

------
____Sash---701_
This goes well with doom - [https://github.com/hlissner/doom-
emacs](https://github.com/hlissner/doom-emacs)

------
Davidbrcz
What's this read aloud package ?

~~~
catalogia
[https://github.com/gromnitsky/read-
aloud.el](https://github.com/gromnitsky/read-aloud.el)

------
michaelmrose
This works quite well.

