Skip to content
Links and Images
step 1/5

Reading — step 1 of 5

Read

~1 min readInline Elements

Links and Images

Inline link:

[text](url)
[text](url "optional title")

Becomes:

<a href="url">text</a>
<a href="url" title="optional title">text</a>

Image (very similar):

![alt text](url)
![alt](url "title")
<img src="url" alt="alt text" />
<img src="url" alt="alt" title="title" />

Reference-style links (defined elsewhere):

[text][label]

[label]: url "title"

Used a lot for repeated URLs — define once, reference many times.

Auto-links:

<https://example.com>     -> <a href="...">https://...</a>
<[email protected]>          -> mailto link

Implementation regex (simplified):

python

Real parsers handle escaped brackets, parens-in-urls, titles, etc. — complex.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…