Live data from Hacker News

Major Mode for Reading EPUBs in Emacs

github.com

51–60 of 70 posts

Re: Major Mode for Reading EPUBs in Emacs

#51

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?

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?

Re: Major Mode for Reading EPUBs in Emacs

#52
post #36
post #25

Earlier quoted context omitted.

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?

> which is, generally, how books and most ebook readers do it Books flush them right. eBook readers usually don't and when they do it's horribly typographically, because they don't use a smart algorithm for hyphenation and line splitting.

books.app on the mac appears to format things nicely. I'm not sure the algorithm is as good as latex, but it seems pretty good.

Re: Major Mode for Reading EPUBs in Emacs

#53
post #51

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?

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?

Fonts are among the last things I want it to encapsulate, I'm kind of a content-formatting separation extremist. In fact I often convert epub books to fb2 just to make my PocketBook use the default font for better readability (perhaps there is a switch somewhere but couldn't find it).

As for the pictures - I'm comfortable with them being Base64-encoded and encapsulated at the end of the FB2 file.

EPUB indeed is more feature reach but from my point of view that is all bloat and unnecessary complexity.

I haven't seen a single ebook which could actually benefit from EPUB features. Whatever features rich typesetting worth saving is rarely published this way anyway, they just use PDF (which is sad but true).

Re: Major Mode for Reading EPUBs in Emacs

#54

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?

Not having page numbers is pretty obnoxious for a book.

Re: Major Mode for Reading EPUBs in Emacs

#55
post #51

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?

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?

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

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

Re: Major Mode for Reading EPUBs in Emacs

#56

Shameless plug for a personal project: 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. :)

More things should use Pandoc as their rendering engine. Why reinvent the wheel when you've already got the whole car?

Re: Major Mode for Reading EPUBs in Emacs

#57
post #51

Earlier quoted context omitted.

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?

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 I don't know what FB2 does, but it's definitely a solvable problem.

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

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

Re: Major Mode for Reading EPUBs in Emacs

#58
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.

Re: Major Mode for Reading EPUBs in Emacs

#59

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?

Not having page numbers is pretty obnoxious for a book.

For a paper book. But for an electronic book it's the opposite. An author/publisher has no idea about the size of the screen of the device the book is going to be read on + many people like to tweak the font and its size. And you don't need the actual numbers as long as you have a clickable ToC.

Page numbers can indeed be very useful for the purpose of non-electronic referencing of pieces of a text, especially if a printed edition of the book exists you need to collaborate with people having such but I would rather use simple anchor tags for this.

Re: Major Mode for Reading EPUBs in Emacs

#60
post #51

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?

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?

I feel like there's a time and a place for not including those things. I write stories (~1-100k words) in Markdown and run them through Pandoc to get epubs, and the results are nice enough with a small bit of custom CSS but I would love to outsource formatting entirely to the viewer. I don't want anything fancier than the sort of formatting you'd see in a mass market paperback.

I recently bought an ebook and found that it was formatted in a custom font, so I "returned" it immediately. I guess this is a philosophical issue to some extent, but I don't think the typical novel is visual content, and I don't know what you're trying to accomplish by overriding my preferred settings for text presentation.

Post reply on HN