Let's say I have a README.md
and I'd like to create a link to a file that contains spaces in its name, file with spaces.md
. I'd like to be able to jump to the file's source code.
/ -- README.md -- File with spaces.md
After inspecting the element in the browser, I figured out what the href
should be (changed it manually, then clicking on it brought me to the page I want to reach):
<a href="username/repository/src/c0mm1th4sH/File%20with%20%spaces.md">
Unfortunately I couldn't accomplish that. Some of the things I have tried so far:
[Link](File with spaces.md) [Link](File%20with%20spaces.md) [Link](File\ with\ spaces.md) [Link]("File with spaces.md")
It results in the following HTML in Bitbucket:
<a href="/username/repository/src/c0mm1th4sH/File%2520with%2520spaces.md"> <a href="/username/repository/src/c0mm1th4sH/File%2520with%2520spaces.md"> <a href="/username/repository/src/c0mm1th4sH/File%5C%2520with%5C%2520spaces.md"> <a href="" title="File with spaces.md">
You can play with the example repository I created.
Update: the bug is gone, so simple spaces or %20
will work now.
Markdown syntax for a hyperlink is square brackets followed by parentheses. The square brackets hold the text, the parentheses hold the link.
You can now attach files, including images, to markdown files while you're editing them in the web. This works just like file attachments in issues and pull requests and supports the same file types.
Press CTRL + SHIFT + P. Select Markdown: Create Table of Contents.
This seems to work well for me: Replace the space with  
.
Source
[Link](File with spaces.md)
Different Markdown implementations (even versions of these) differ in how they handle these. I found the following very informative (click on "preview" after the page fully loads - it takes a while):
http://johnmacfarlane.net/babelmark2/?text=%5B1%5D(is+not)+OK%2C%0A%5B2%5D(is%2520not)+OK%2C%0A%5B3%5D(%22is+not%22)+OK%2C%0A%5B4%5D(%22is%2520not%22)+OK%2C%0A%5B5%5D(is%5C+not)+OK.%0A
Summary if the link stops working... Five different possibilities are shown against many different implementations:
[1](is not) OK, [2](is%20not) OK, [3]("is not") OK, [4]("is%20not") OK, [5](is\ not) OK.
It appears that all work somewhere but #2 seems to work everywhere (or almost everywhere) and every other option fails in at least one case.
Output:
marked 0.5.2, MD4C 0.2.7, MD4C (strict) 0.2.7, markdig 0.15.6.0
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
commonmark.js 0.28.1, markdown-it 8.4.2
[1](is not) OK, 2 OK, 3 OK, 4 OK, 5 OK.
Markdown.pl 1.0.1, Python-Markdown 2.6.5
1 OK, 2 OK, 3 OK, 4 OK, 5 OK.
Markdown.pl 1.0.2b8
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
pandoc (strict) 2.5
1 OK, 2 OK, 3 OK, 4 OK, 5 OK.
cheapskate 0.1.0.5, Parsedown 1.6.0
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
pandoc 2.5
1 OK, 2 OK, 3 OK, 4 OK, 5 OK.
lunamark 0.4.0
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
RedCarpet 3.3.4
1 OK, 2 OK, 3 OK, 4 OK, 5 OK.
RDiscount 2.1.8
1 OK, 2 OK, 3 OK, 4 OK, 5 OK.
PHP Markdown 1.8.0, PHP Markdown Extra 1.8.0
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
Maruku 0.7.3.beta1, Maruku (Math-Enabled) 0.7.3.beta1
1ot) OK, 2 OK, 3ot“) OK, 4 OK, 5ot) OK.
MultiMarkdown 5.1.0
[1](is not) OK, 2 OK, [3](“is not”) OK, 4 OK, [5](is\ not) OK.
Blackfriday
1 OK, 2 OK, [3](“is not”) OK, 4 OK, 5 OK.
kramdown 1.2.0, mistune 0.8.3
1 OK, 2 OK, 3 OK, 4 OK, 5 OK.
MultiMarkdown 6 6.3.0
1 OK, 2 OK, 3 OK, 4 OK, 5 OK.
s9e\TextFormatter (Fatdown/PHP)
[1](is not) OK, 2 OK, [3](“is not”) OK, 4 OK, [5](is\ not) OK.
cebe/markdown 1.2.0, cebe/markdown GFM 1.2.0, cebe/markdown MarkdownExtra 1.2.0
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
Gambas 3.8.90
1 OK, 2 OK, OK, OK, 5 OK.
showdown 1.7.4
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
showdown (flavor: github) 1.7.4
[1](is not) OK, 2 OK, 3 OK, 4 OK, [5](is\ not) OK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With