我可以链接到 GitHub wiki 中的下载文件(PDF 除外)吗?

人气:996 发布:2022-10-16 标签: hyperlink github wiki

问题描述

当您使用以下方式链接到 PDF 文件时:

When you link to a PDF file using:

[下载这个](file.pdf)

它下载pdf文件.我有一个 excel 工作簿,我想允许某人使用以下方法下载:

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

[下载这个](file.xlsx)

当我点击它时,我会在 wiki 中创建一个新页面.我可以添加任何降价语法来将链接标识为要下载的内容吗?

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?

如果需要,我可以将 excel 工作簿另存为 PDF,但它不会很漂亮.

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

谢谢!

推荐答案

首先,尝试在您的 wiki 中创建一个 files 子目录,并将您的文件放在那里.

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

我尝试使用 html 锚标记

I tried using an html anchor tag

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

代替 markdown 链接语法

instead of the markdown link syntax

[download this](files/file.csv)

但似乎 GitHub wiki 从锚标记中删除了下载属性.

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

最后,我将电子表格压缩到一个 zip 文件中,并将 Markdown 链接指向该 zip 文件.

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)

467