decker-edu / decker

A markdown based tool for slide deck creation.
GNU General Public License v3.0
55 stars 14 forks source link

Mark Link as download #32

Closed salbeira closed 1 year ago

salbeira commented 1 year ago

We had a case where we wanted a user to download an example image but linking it in a deck with [Download](URL) causes the browser to open the file as an image. You can mark anchors as explicit download links in HTML:

<a href="" download>Download</a>

It would be neat if we could mark links as such in markdown as well:

[Download](URL){download}
monofon commented 1 year ago

Try

[Download](assets/picard-facepalm.jpeg){download=""}
salbeira commented 1 year ago

That does indeed work but for mere usability I feel allowing simply "download" just like in the html tag would be more concise but I will write that down for now.

monofon commented 1 year ago

Just download is difficult to implement, because Pandoc does not support it. We would need a custom Pandoc parser.

salbeira commented 1 year ago

Would .download be parsable? I just feel the empty value for download would be confusing users.

monofon commented 1 year ago

How about

[Download](assets/picard-facepalm.jpeg){download="fuck, yes"}

.download would be a class not an attribute. If you can come up with some CSS that makes this trigger a download, go for it.

salbeira commented 1 year ago

OK, I thought that because we have classes like .embed or .details that parsing the link for the class would be easier.

monofon commented 1 year ago

Both .embed and .details are not classes that are just translated into attributes.

salbeira commented 1 year ago

I will close this. As long as we document how to do it I think even the ="" isn't so bothersome.