hedgedoc / cli

A tiny CLI for HedgeDoc
GNU Affero General Public License v3.0
153 stars 37 forks source link

Also download images when using export #41

Open theRealSuperMario opened 3 years ago

theRealSuperMario commented 3 years ago

So I was wondering if there already exists an option to also download the images that are added to the notes.

In that case, one might need to change the url of those images in the document as they are not referring back to the server anymore.

It would have the advantage that the export is actually standalone and offline accessible (might not be relevant if running on localhost)

If something like this does not exist yet, is there any reason why I shouldn't give it a try?

Just asking so that I am not doing something that won't be needed after all.

Cheers 🍻

pirate commented 3 years ago

Adding these two flags to the wget command should do the trick: --convert-links --page-requisites, you can run it manually like so:

wget \
    --convert-links \
    --load-cookies "$HEDGEDOC_COOKIES_FILE" \
    --output-document "$output_path" \
    --convert-links \
    --page-requisites \
    "$HEDGEDOC_SERVER/s/$public_id"

We could also add it as a config option to the CLI.

https://github.com/hedgedoc/cli/blob/master/bin/hedgedoc#L222