shafayetShafee / downloadthis

A Quarto shortcode extension to embed download buttons (to download embedded image/pdf/txt/csv files) in HTML document
https://shafayetshafee.github.io/downloadthis/example.html
MIT License
46 stars 0 forks source link

Download file from weblink #8

Open DougManuel opened 1 year ago

DougManuel commented 1 year ago

Is it possible to download a file from a weblink?

See the example below from the downloadthis R package that inspired your quarto shortcode. https://fmmattioni.github.io/downloadthis/index.html#web-address

## Link in Github repo
download_link(
  link = "https://github.com/fmmattioni/downloadthis/raw/master/inst/example/file_1.pdf",
  button_label = "Download pdf file",
  button_type = "danger",
  has_icon = TRUE,
  icon = "fa fa-save",
  self_contained = FALSE
)
shafayetShafee commented 1 year ago

Um, no. I have not implemented download_link in this extension, mostly because this extension is not even needed to create a download button with a web link. I mean you can create the button using the raw html. Consider the following reprex,

---
title: "download_link"
format: html
---

## Quarto

<a href="https://github.com/fmmattioni/downloadthis/raw/master/inst/example/file_1.pdf"><button class="btn btn-danger">Download Link</button></a>

image


Anyway, I will try to implement download_link in this extension for people who want to avoid using raw HTML as soon as possible 😃.

DougManuel commented 1 year ago

Or the same button could be created by adding css classes. Maybe the extension isn't needed? Maybe just a vignette?

The example below adds the pdf icon using the Quarto FontAwesome extension.

[Download Link {{< fa file-pdf>}}](https://github.com/fmmattioni/downloadthis/raw/master/inst/example/file_1.pdf){.btn .btn-danger}