reddit / emacs
Turning EPUBS into files
chilioil · 2022-06-15 21:42
I'm learning how to use Emacs with one main idea in mind. I need a powerful system to track and annotate books that I am reading. I installed org-roam and want to start learning it by using it along side a book I am reading (a physical copy).
An example of what I'm trying to do is the quote "transmigration of souls" in this book. What I would like to do is link this quote to a org-roam note to document my thoughts. What attracted me to org-roam in the first place is that with back-linking, if I ever read my note on "transmigration of souls" (say, encounter it in another book) in the future, I see that it was referenced in this book (and whatever other sources).
How would I go about turning an ebook into "org-roam" file that I could then link from and too (as in books that reference each other). I also seek to use "org-roam" files as books to allow grepping/annotating/etc.
If I am doing this incorrectly, asking the wrong question, or misusing the concept behind org-roam please let me know. I also don't know if "org-roam file" is the right term. Is it an "org-roam file" a "org-mode file" or a txt file with org-roam/mode notation?
vaxdar · 2022-06-15 22:45
Pandoc can probably convert from epub to org. Org roam uses org-mode format files.
chilioil · 2022-06-15 23:19
Thank you, and now I have an org file. How do I turn that into a org-roam node?
Edit: NVM found it, "org-id-get-create"
xtifr · 2022-06-16 01:22
The package nov.el allows Emacs to access and read epub files directly, at which point all of Emacs's and org-mode's usual facilities should be available. Less certain about org-roam, which I don't (yet) use.
krypt3c · 2022-06-16 01:33
They certainly get points for the package name
deerpig · 2022-06-16 03:54
Roam files are org files with a uuid.
Add the id using org-id-get-create to a heading. This inserts a uuid in a properties box. Then move the file into the path where org-roam looks for files and you should be all set. You can set a lot of other things -- which are documented in the org and org-roam manuals.
Here is an typical header for one of my org-roam files which I generate using yasnippet:
# -*- mode: org; fill-column: 60 -*-
#+STARTUP: showall
#+TITLE: Koku Pattern Language—3#+
FILETAGS: "hord" "pattern"
#+bibliography: ~/proj/hord/bib/bib.bib
* Koku Pattern Language—3
:PROPERTIES:
:ID: ec3ffc9f-e78f-4f91-8581-c3f3d7072a77
:TYPE: pat/pattern
:NAME: /home/deerpig/proj/ybr/patterns/toc.org
:CREATED: 2022-05-13T09:31
:VER: 705681165.754049563
:GEO: 48P-491193-1287029-15
:LICENCE: MIT/CC BY-SA 4.0
:END:
gogaxxx · 2022-06-16 12:41
EPUB is just a zip file with a bunch of html's inside. Rename, unpack and do whatever.
akirakom · 2022-06-16 15:19
An EPUB file is a collection of HTML files in a ZIP archive. In theory, all you need is an HTML-to-Org converter, with support for handling links to media files in the archive.
I am working on [a project](https://github.com/akirak/orgabilize.el) that converts HTML web pages to Org, but actually it is a tough problem, especially because quite a few web pages abuse HTML tags. EPUB HTMLs may be slightly easier, but I am not sure.
chilioil · 2022-06-16 16:49
Interesting, so does the :PROPERTIES: uuid not need to be at the absolute top of the document?
chilioil · 2022-06-16 17:14
So I tired pandoc, it created an org file except the file that was created was pretty messed up. The main issue was that for some reason all the links where \[\[../Text/blahblahblah\]\[link\]\] If I went through and manually removed the ../Text/ the links start working but it's pretty messed up file, with broken links and html all over the place.
On the other hand nov.el created a pretty much perfect file for m(except that instead of moving the whole word to new line it br
eaks them up). But I can't edit the words at all or link to/from them, annotate them, etc.
I wish I could get nov.el looks with org-mode functionality.
deerpig · 2022-06-17 01:30
Org-roam v2 treats headings with an id to be a separate node. That was a big breaking change from the org-roam v1 which treated files as nodes.
​
>The key difference between v1 and v2 is that v2 makes no distinction between a
file note and a headline note. In v2, Org-roam views notes in terms of nodes,
where a node is any headline or top-level file with an ID. This means that IDs
are now compulsory.
>
>This one requirement reduces a lot of overhead. We no longer need special hooks
maintaining the validity of file: links, and no longer have to treat headline
and file notes differently. Org-roam v2 removes 7000 lines of code while only
re-adding about 4000, and even ships with a few more features than Org-roam v1.
>
> https://blog.jethro.dev/posts/org\_roam\_v2/
This change caused no small amount of pain for users like me who have large collections of notes that use a lot of custom metadata. The scripts to automatically upgrade to v2 didn't work for me. It took me a couple of months to migrate it all by hand.
But I fully support the change because it is far more flexible and powerful in the long run. What's a couple of months work when you are talking about something I could be using all day, every day for more than another decade?
akirakom · 2022-06-17 10:27
Actually, nov.el uses shr to render HTML as eww does, so you probably can use [shrface](https://github.com/chenyanming/shrface).
simbledress · 2022-06-18 06:06
OP could use it together with [org-noter](https://github.com/weirdNox/org-noter).