Can I link to a file for downloading (other than PDF) in a GitHub wiki?

那年仲夏 提交于 2019-11-28 04:01:41

问题


When you link to a PDF file using:

[download this](file.pdf)

it downloads the pdf file. I have an excel workbook that I'd like to allow someone to download using:

[download this](file.xlsx)

When I click it, it takes me to create a new page in the wiki. Is there any markdown syntax I can add that identifies the link as something to download?

If I have to, I can save the excel workbook as a PDF, but it's not going to be pretty.

Thank you!


回答1:


First, try making a files subdirectory in your wiki, and putting your files in there.

I tried using an html anchor tag

<a href="files/file.csv" download="file.csv">download this</a>

instead of the markdown link syntax

[download this](files/file.csv)

but it seems that GitHub wiki strips out the download attribute from the anchor tag.

In the end, I zipped my spreadsheet in a zip file and had the markdown link point to the zip file.

[download this](files/file.csv.zip)


来源:https://stackoverflow.com/questions/45069794/can-i-link-to-a-file-for-downloading-other-than-pdf-in-a-github-wiki

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!