![]() |
#1 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7
Karma: 99144
Join Date: Dec 2020
Device: Kindle PaperWhite
|
Include location URL links in the highlights text export?
Is there any way the highlights text export function in the viewer can include URL links to each highlight location (e.g. as a Markdown link, or just the plain URL)? It would seem to make sense given the wonderful new URL location functionality for ePUB, but I can't find any setting or way to make it happen.
If not, is it realistic to self-teach myself enough Python and Calibre dev to implement this, or can I offer a bounty for someone else to implement? I gather there aren't any plugins for the Viewer, so it's somewhere in the core code (highlights.py? – I can move this to the Development forum.) This functionality would make it possible to generate book notes and store them in most note-taking software while maintaining links back to the exact source in one's Calibre library. I know a lot of people who would love this...! And it doesn't seem to be supported by any other ePUB reader afaik. Thanks for any insight/advice/guidance, and thank you as always for this amazing piece of software. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,276
Karma: 27111060
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
IIRC currently the export of highlights happens in either pain text or JSON. The JSON export already contains the data needed to create links, so adding it there is trivial. But I dont think you mean JSON. In plain text I am not sure, it makes sense, the link is quite ugly.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7
Karma: 99144
Join Date: Dec 2020
Device: Kindle PaperWhite
|
I'm thinking of a Markdown export, which would basically be the same as text, but with the URL link added in markdown format, i.e.
Code:
[link text](URL) Code:
"Who are you you?" said the Caterpillar. [2020-12-23 6:35 PM](calibre://view-book/_hex_-43616c696272655f4c6962726172795f4d696e69/1573/EPUB?open_at=epubcfi(/4/2/4/282/1:0)) I reviewed the JSON ("calibre highlights") and it does indeed seem to have all the necessary info, although I'm not sure about the hex reference for the book I see in the location URL. I would guess that's somehow equivalent to the uuid value? I guess if all else fails, I can try to teach myself how to parse the JSON into a Markdown. But if this were a quick fix to add as a Markdown export option, I can guarantee it would be popular with the Markdown/book annotator communities. I'm already a patron, but I would gladly send an additional thank-you contribution via Paypal, as it would make my year. I've been looking for this for years and got all excited when I saw the URL functionality in this release. Thank you for the swift reply and the patience with my ignorance. Much appreciated! |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,276
Karma: 27111060
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Well, that's easy enough: https://github.com/kovidgoyal/calibr...36a10879860e0d
|
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7
Karma: 99144
Join Date: Dec 2020
Device: Kindle PaperWhite
|
This is amazing!
One possible correction: I think line 194 of annotations.py might need to read "view-book" rather than "show-book". When I make that correction to the exported text, it works fine in the markdown editors/viewers I could test, namely Bear, ia Writer, Typora and Roam Research. This is monumental for me. I've already sent a token of my deep appreciation through Paypal, but will share the feature in note-taking forums and encourage others to pitch in as well. Again, thank you! |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,276
Karma: 27111060
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
oops, yes, you are correct https://github.com/kovidgoyal/calibr...b8a2d0ff5e25df
|
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7
Karma: 99144
Join Date: Dec 2020
Device: Kindle PaperWhite
|
Hello!
Now that the feature is fully available in release 5.9.0, I'm writing it up to share more broadly. Quick question: is there a shortcut to copy a location to clipboard as an URL while in the ebook viewer? E.g. Right now, from whatever text I want to capture the location of, I need to hit "Esc", then "Goto", then "Location", and then the "Copy" button to capture the URL. Is there a way to bind this to a key shortcut? I looked in Preferences, but couldn't find anything obvious. Alternatively, could I make a feature request? In the ebook viewer, add to the "selected text popup" a "cite" option that copies the selection along with a markdown link to the URL location to the clipboard, e.g. "'selected text here' –(book title)[calibre://view-book....]" I would be happy to offer a $200 for this feature, as I use it regularly for research. In any case, this functionality is a gamechanger for me. Thank you again! |
![]() |
![]() |
![]() |
#8 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7
Karma: 99144
Join Date: Dec 2020
Device: Kindle PaperWhite
|
p.s. for your reference (any feedback/correction welcome): Calibre + Roam Research = hyperlinked smart book notes
|
![]() |
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,276
Karma: 27111060
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#10 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7
Karma: 99144
Join Date: Dec 2020
Device: Kindle PaperWhite
|
This is fantastic! I'm sending my contribution now.
When testing it out, I'm noting one quirk, which is that for some books there are one or more square-bracketed snippets of text within the URL location (specifically in the epubcfi string) that are unescaped and "break" the Markdown link, e.g. [ch1] in the following Code:
epubcfi%28/14/2/4/2[ch1]/138/1:0%29 Thanks again. This is an amazing tool for me! |
![]() |
![]() |
![]() |
#11 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,276
Karma: 27111060
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Why would square brackets break markdown formatting? Isnt a markdown link of the form
[text](url) so square brackets in the url part should not break anything. |
![]() |
![]() |
![]() |
#12 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7
Karma: 99144
Join Date: Dec 2020
Device: Kindle PaperWhite
|
You're quite right. It does break the link in Roam Research (which I mainly use), but that appears to be an implementation issue on their end. I'll follow up there.
Those same links with square brackets within the URL worked just fine in iaWriter, Bear and Typora (the other Markdown editors I know & use). What I found curious is that the information in brackets did not appear to be necessary for the location link to work, which suggests to my amateur self that maybe some part of the code is being too verbose. Maybe one day I'll know enough about CFI to have an idea of what's going on there. In any case, thank you! I've sent $$ in appreciation and will share as much as I can. If I ever make it to Mumbai again, I owe you a couple of dinners at least. |
![]() |
![]() |
![]() |
#13 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,276
Karma: 27111060
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Cool, glad to hear it. And the part in the square brackets is an optional id assertion, it makes the CFI more robust against editing.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Export Moon+ highlights as a plain text readable file? | blorg | Android Devices | 10 | 08-18-2024 01:33 PM |
Export whole chapter (complete text) with highlights? | Fralippo | Marvin | 2 | 10-24-2016 07:11 PM |
PDF: Highlights in images correct, copied text from highlights truncated | wonderose | Android Devices | 0 | 08-02-2015 11:25 AM |
Include URL in Pocket articles | Kitezh | Recipes | 5 | 10-15-2013 10:37 PM |
Google eBookstore ePub export, include DRM? | gnychis | Calibre | 2 | 12-07-2010 07:07 PM |