Links and Images
Markdown provides convenient syntax to add both links and images within your document. Here is how you add links and images in your document.
Links
Inline Link
To create a clickable link inline, use square brackets []
for the link text followed by parentheses ()
containing the URL. For example,
The above example uses absolute link to link to other page. You can also use relative link to link files present locally on you computer. The below example shows how to link a file named codeblock.md
present within the current working directory.
Click [here](./codeblock.md) to see how to format code in markdown.
This renders as
Click here to see how to format code in markdown.
Section Link
You can also link to different sections within a Markdown document. For example,
Click [here](#) to go back to top.
Click [here](#links) to see how to add links in Markdown.
This renders as
Some key points:
#
links back to top of a page.- Markdown automatically generates
id
for every heading and is used to link to different sections within a document. In the above example,links
is anid
.
Images
To add an image, use an exclamation mark !
, followed by square brackets []
for alt text, and then parentheses ()
for the image path.
![Markdown Logo](https://upload.wikimedia.org/wikipedia/commons/4/48/Markdown-mark.svg)
This renders as
You can also give a title to an image using the following syntax.
![alt-text](image_url "title")
You can even use relative path to link to an image present locally on your computer.