Markdown cheatsheet · Links

Markdown links

The visible text goes in square brackets, the URL in parentheses, nothing in between: [text](url).

The syntax

You type
Try [maxdown](https://maxdown.app),
a native markdown editor.
You get

Try maxdown, a native markdown editor.

To show a bare URL as a clickable link, wrap it in angle brackets. Many renderers (GFM included) also auto-link plain https:// URLs without the brackets.

You type
<https://maxdown.app>

Link titles

A quoted string after the URL becomes the tooltip shown on hover.

You type
[maxdown](https://maxdown.app "Markdown to the max")
You get

maxdown (hover it)

Linking to a heading on the same page

Most renderers give every heading an automatic anchor: the text lowercased, spaces replaced by dashes, punctuation removed. Link to it with a #. The exact slug rules are fiddly enough to trip most people up; anchor links covers them in full.

You type
See [the setup guide](#getting-started).

## Getting started
You get

See the setup guide.

Getting started

Reference-style links

For prose with many links, you can keep URLs out of the text: use a label in a second pair of brackets, and define it anywhere in the document (usually at the bottom).

You type
Built with [Rust][1] and [Tauri][tauri].

[1]: https://www.rust-lang.org
[tauri]: https://tauri.app
You get

Built with Rust and Tauri.

Spaces and parentheses in URLs

A space breaks the URL parsing. Either encode it as %20 or wrap the URL in angle brackets: [notes](<my file.md>). A closing parenthesis inside a URL (common with Wikipedia) should be escaped as \) or the URL wrapped the same way.

Opening a link in a new tab

Plain markdown can't do this. A [text](url) link always opens in the same tab, because markdown has no place to put the target that controls it. Where inline HTML is allowed, drop to an anchor tag:

You type
<a href="https://maxdown.app" target="_blank" rel="noopener">maxdown</a>
You get

maxdown (opens in a new tab)

Always add rel="noopener". Without it, the page you open can reach back to yours through window.opener, a real security and performance issue. The thin pages that answer this question with just target="_blank" leave it out. It costs nothing and closes the hole.

Two caveats: GitHub strips target for security, so on GitHub every link opens in the same tab no matter what; and forcing new tabs is widely disliked because it takes the back button away from the reader. Use it sparingly, if at all.

Common questions

Can I make an image a link?

Yes: put the image inside the link text, [![alt](image.png)](https://example.com). See the images guide.

Related syntax

· All markdown guides

Less syntax. More writing.

Download maxdown

Free · no account · macOS, Windows & Linux