A brief introduction on Markdown

in #markdown8 years ago (edited)

Markdown is a lightweight markup language with plain text formatting syntax designed so that it can be converted to HTML and many other formats using a tool by the same name. Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor. (Source)

Steemit uses Markdown to format posts and comments. Seeing that a lot of people are asking how to insert images or format text and that many of the comments and posts are poorly formatted, I would like to contribute with this short reference post and tutorial.

First thing's first: bold and italic

(apparently bolded text in headings gets overridden)

To make text appear you can surround words with two asterisks. Conversely, to make a phrase italic in Markdown, you can surround words with an underscore or a single asterisk.

Example:

_word_ => word
*word* => word
**word** => word


Headers

To format headers 1-6 add one to six #characters in front of the heading line. The # character needs to be at the beginning of the line, otherwise this won't work. You can also underline Heading 1 with equal signs and Heading 2 with hyphens.

Example

# Heading 1
or
Heading 1
=========

Heading 1


## Heading 2
or
Heading 2
---------

Heading 2


### Heading 3

Heading 3


#### Heading 4

Heading 4


##### Heading 5

Heading 5

###### Heading 6

Heading 6

Links

To add a link, surround the text in square brackets and add the link in parenthesis immediately after.

Example:

[This is a link](https://steemit.com) => This is a link


Images

To add an image, surround the text in square brackets as you would for a link, adding an exclamation mark at the very beginning and the link to the image in parenthesis immediately after. The text in square brackets will act as the alt text (good for accessibility) and is optional

Example:

![This is an image](https://placehold.it/120x120) => This is an image

or

![](https://placehold.it/120x120) =>


Horizontal Line

To add a horizontal line type *** or --- on a single line.


Inline code

`Inline code` with backticks Inline code with backticks


Code blocks

```
# code block
print '3 backticks or'
print 'indent 4 spaces'
```

becomes

# code block
print '3 backticks or'
print 'indent 4 spaces'

You've probably noticed that this article is neatly formatted and has images and links and stuff, but also has the plaintext that's being parsed. Yes, i've written this entire text using markdown, so i've had to escape some of the characters that would've triggered different formatting. To escape characters that markdown converts use a backslash (\). This way_word_ stays _word_ and doesn't get parsed into word.