roam-to-git icon indicating copy to clipboard operation
roam-to-git copied to clipboard

Exporting of media

Open ghost opened this issue 5 years ago • 6 comments

It would probably very useful if images and PDF stored on Roam would be exported as well.

Via this thread (closed forum, but props where they are due), they look like an "easy" regex to find:

"string": "![](https://firebasestorage.googleapis.com/[..]/o/imgs%2Fapp%2FMY-GRAPH%2F-[IMAGEID].png?[AUTH_DELETED]

Alas, I don't know how complicated it would actually be to have the attachments downloaded just because they're easy to find.

ghost avatar Jul 16 '20 10:07 ghost

@MatthieuBizien would you like help with this?

gunar avatar Aug 10 '20 13:08 gunar

Hi @benwf! I agree that feature would be nice, but I will not be able to work on it in the short time. PR welcome 😀

MatthieuBizien avatar Aug 16 '20 15:08 MatthieuBizien

I'd love to pass the torch to @gunar if he's still interested ;)

ghost avatar Aug 19 '20 10:08 ghost

Sure I'll take a stab at it

gunar avatar Aug 19 '20 10:08 gunar

I hadn't realized this codebase is written in Python. It'd take too long for me as I'm not used to Python tooling.

For concern of losing my images, I've written this short bash script to download images from the generated markdown files. It doesn't retroactively update the markdown files but at least you've got your images with you. Anyway, this might be an interim solution for whoever comes to this GH issue:

#!/usr/bin/env sh
ag -o "!\[.*\]\((.*)\)" | ag -o "\([^)]*" | cut -c 2- \
  | parallel -j 8 --halt never wget -P images --continue {}

Run it inside formatted/. You'll need the silver searcher.

Anyway, this is a hack and we'd love it if someone could contribute to this feature.

gunar avatar Aug 19 '20 13:08 gunar

Solution: I've built a thing called markdown-backup to solve this problem. It downloads the images linked inside markdown files, and rewrites the link to point to the new local files. There are instructions on how to use it with roam-to-git. Feedback welcome.

gunar avatar Oct 03 '20 13:10 gunar