GithubHelp home page GithubHelp logo

Comments (10)

deathau avatar deathau commented on July 20, 2024

This is something I have thought about. As discussed in issue #21 I'm unable to specify a download folder, and can't pick where I write things to. I can download multiple files at once, but they'll either all get dumped to the downloads folder or display a large number of "save as" modals...

My thoughts to get around this are to potentially pack all the images into a zip file, so there's only one download. But it needs more research and thought put into it.

Thanks for the suggestion, though! And the insights about having a prefix for the image name — that's a good idea 💡

from markdownload.

dxcore35 avatar dxcore35 commented on July 20, 2024

Let me also share this app with you: https://optimage.app so you can see what it can do. It will be amazing to optimize images after downloading them, this feature will be consider as luxury feature :D

The code is open-source and available to use as python module.
https://github.com/sk-/optimage

from markdownload.

montemartin avatar montemartin commented on July 20, 2024

@deathau check out https://addons.mozilla.org/en-US/firefox/addon/maoxian-web-clipper/. They are able to bypass the save as locations with some manual setup by the user.

It also creates folders within the downloads folder by default. My thinking would be to do something similar to a browsers default Save Page As... functionality. Create a folder with a name matched to the name of the download file and use relative links to the images within that folder. I've found that to be a common pattern for apps that export files to markdown.

Then he end user could setup something like https://github.com/tfeldmann/organize or Hazel to move the file and folder to the desired location and optimize images. I'd be happy to write some docs on how to do it.

from markdownload.

deathau avatar deathau commented on July 20, 2024

I was still tossing up between zipping images and having a subfolder. Thanks for your input @montemartin. Thinking about it more, the subfolder thing is pretty standard (even when you just SaveAs a HTML page). That's probably the route I'll take.

from markdownload.

deathau avatar deathau commented on July 20, 2024

Also, organize looks pretty cool. If you do end up writing up a guide, I'd be happy to link it in my extension's description

from markdownload.

montemartin avatar montemartin commented on July 20, 2024

from markdownload.

deathau avatar deathau commented on July 20, 2024

I've committed this functionality now: There's an option to download images, and a "prefix" for the images (which can use the same template substitutions as title/frontmatter/backmatter).

If you use a '/' in your prefix, that will create a subfolder when you download. So by default you could have {title}/image_ and all images will get the image_ prefix in a {title} subfolder. This subfolder is relative to wherever you choose to download the .md file

from markdownload.

montemartin avatar montemartin commented on July 20, 2024

This is a perfect solution! It solves several problems for me.

There does seem to be one small bug when combined with subfolders in the filename template. Images are still being created relative to the downloads folder instead of the file location after factoring in the filename template.

For example if my template is {title}/{date:YYYYMMDDHHMM}-{title}.md if the downloads prefix is set to images/ I'd expect images to end up in ~/Downloads/20201028230504/{title}/images. They are actually still downloading to ~/Downloads/images/.

I assume this wasn't the intended behavior. The filepath in the image links is set relative to the actual Markdown file, (i.e. ![](image/filename.ext) in the example above). Replicating the entire filename template in the downloads prefix field does put the images inside the same subfolder as the actual file, but writes the links with a path relative to the downloads folder and they still don't work.

The somewhat inelegant solution I came up with is to use the prefix {title}_images/. That makes it easy to associate the images folder with the correct folder and simply move it so the images are located correctly.

from markdownload.

deathau avatar deathau commented on July 20, 2024

Ah, yeah, silly me I didn't make the image path relative to the .md path (because I'm basically just using both as a prefix to the filename that gets downloaded). I'll add it to my to-do list to check if the title template also has a slash and if so, get everything up to the last slash added to the image prefix as well.

In the meantime, another workaround would be to use the same prefix in both. For example, if your title template is {title}/{date:YYYYMMDDHHMM}/{title} you could set your image prefix to {title}/{date:YYYYMMDDHHMM}/images/
... which could be weird when I make it relative.

from markdownload.

adamalbrecht avatar adamalbrecht commented on July 20, 2024

Also check out the TextBundle format: http://textbundle.org

from markdownload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.