Hacker News new | ask | show | jobs
by longlivebooks 1316 days ago
What if we had a world where digital books were just .txt files? E-book readers can format the book with any font, margins, or layout they want, but the book itself is just a plain text file. Is such a world possible?

I believe that simple text files can bring books to life regardless of the technology used. Even if all e-readers are gone, you can still use Vim or Notepad to read books. Even if the editor went away, I could code a small editor to convert the bytes in the file to characters on the screen.

2 comments

A few books need images. For instance, to show up some weird figures in mistery books.
Then there are various typographical and layout features – at a very minimum cursive, bold and possibly underlines should be not that uncommon. Quite a few books use footnotes, which are a bit of a paint to represent in a plain text format that's lacking the ability to explicitly link footnote symbols with their corresponding texts. (So you either need to introduce hard pagination, or convert them to endnotes, neither of which is really satisfactory.)

Sometimes the pagination is explicitly played with, so even if your digital book doesn't use hard pagination, it'd still be useful to at least being able to force a new screen page.

Font sizes occasionally get used for creative effects or to otherwise convey meaning, and the same goes for font selection itself. Sometimes even colour is used.

And some books get quite creative in with playing with layout and typography effects. The Raw Shark Texts had some ASCII-art style pages, but utilising a proportional font (!) [1], and House of Leaves went totally bonkers in its use of creative typography (https://www.google.com/search?q=House+of+Leaves+typography&t...).

[1] Even if those were based on a fixed-width font, you still need a way of indicating to the e-book reader software "Hey, here's some ASCII art, please don't reflow the text here and don't put a page break in the middle of the art, either". With a proportional font you either need to make sure the exact same font you used for layouting also gets used for display, or just give up and include that text as an image (and an appropriate alt-text, especially if the text for the ASCII-art isn't just random gibberish, but actually meaningful text, too).

That's pretty much what epub files are. You can unzip them and then read the html they contain. You can also use something to strip the html tags and only plain text will remain.
Exactly. And some modern books are taking full advantage of that fact and including javascript for interactivity. Though I'm not really a fan of this direction, some of the childrens books I've worked with have been pretty cool.

Also note that while EPUBs are zips, the first few bytes are not compressed. Doesn't matter when unzipping, but if you want to make changes and re-zip you have to account for it.