DEV Community

Cover image for Markdown for dummies
Gaurav Rathor
Gaurav Rathor

Posted on

Markdown for dummies

Many times, as beginners, when we start programming and begin creating project repositories or explore some repositories especially those hosted on platforms like GitHub, we often come across a file called README.md. This file is usually the first point of contact for users and developers who want to understand the purpose, setup, and usage of a project.

The README.md file contains documentation added by the project owner, but along with the actual text content, you'll often see extra symbols. These extra symbols are part of a markup language called Markdown.

Markdown is a lightweight markup language used to format text, which is easy to write and read. It allows us to organize content with simple markup rules to include elements like headings, tables, images, code blocks, and font styling.

Markdown files have the .md or .markdown extension. Its most commonly used in README file, documentation, blogs post and even this article is written in Markdown.

Now, let’s see some elements of markdown language.

Headings

Headings make your text more readable and help you organize different topics. A heading is created by adding # character before the heading text. Numbers of # symbols determines the level of the heading.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
Enter fullscreen mode Exit fullscreen mode

Paragraph

You don't have to add any extra symbols for creating paragraphs. To split content into different paragraphs simply insert a blank line.

paragraph 1
paragraph 2

paragraph 1  
paragraph 2
Enter fullscreen mode Exit fullscreen mode

Emphasized text

Bold - Bold Text or bold text
Italics - Italic Text or italics
Strikethrough - crossed off

Bold - **Bold Text** or __bold text__ 
Italics - *Italic Text* or _italics_
Strikethrough - ~~crossed off~~
For some element you can use html as well. Highlight: highlighted text Superscript: 642 Subscript: h2o
Highlight: <mark>highlighted text</mark>
Superscript: 64<sup>2</sup>
Subscript: h<sub>2</sub>o

List

We can have both ordered and unordered list, we can also use nesting in list.

  • Unordered list can use asterisks
  • Or minuses
  • Or pluses
  1. ordered list need to have number followed by dot
  2. Actual numbers don't matter, just that it's a number
    1. ordered item 3
    2. ordered item 3
  • unordered item 1
  • unordered item 2
    • nested item 1
    • nested item 2
  • unordered item 3
// unordered list
* Unordered list can use asterisks
- Or minuses
+ Or pluses

// ordered list
1. ordered list need to have number followed by dot
2. Actual numbers don't matter, just that it's a number
   1. ordered item 3
   1. ordered item 3

// Nested list
* unordered item 1
* unordered item 2
    * nested item 1
    * nested item 2
* unordered item 3
Enter fullscreen mode Exit fullscreen mode

Links

There are few different ways to create links.

Google Maps

Google link with title
Google Link
Reference to a repository file

When we want to use actual URL as text.

https://www.google.com/maps

[Google Maps](https://www.google.com/maps)  
[Google link with title](https://www.google.com "Sample title text")
[Google Link][case-insensitive reference text]
[Reference to a repository file](../blob/master/LICENSE)

<https://www.google.com/maps>

[case-insensitive reference text]: https://www.mozilla.org
Enter fullscreen mode Exit fullscreen mode

Images

There are two ways to add images.

Inline-style:
alt text

Reference-style:
alt text

Inline-style: 
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")

Reference-style: 
![alt text][logo]


Enter fullscreen mode Exit fullscreen mode

Quote

Quote text

Quote break

This is a very long line that will still be quoted properly when it wraps. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

> Quote text
> Quote
Enter fullscreen mode Exit fullscreen mode

Horizontal Rule

Horizontal rules can be added by adding three or more asterisk , dashes or underscore (*, -, _)




// You need to add three or more
***
---
___
Enter fullscreen mode Exit fullscreen mode

Code and Syntax Highlighting

We can add code block with syntax highlighting by wrapping them in single back-ticks or triple backticks for code multiple lines

Inline code has back-ticks around it. Eg: let max_Number= 0

Multiple lines with particular language



```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```




```python
s = "Python syntax highlighting"
print s
```




```
No language indicated, so no syntax highlighting. 
But let's throw in a <b>tag</b>.
```

function render (text) => {
   return text 
}
Enter fullscreen mode Exit fullscreen mode
var s = "JavaScript syntax highlighting";
alert(s);
Enter fullscreen mode Exit fullscreen mode
s = "Python syntax highlighting"
print s
Enter fullscreen mode Exit fullscreen mode
No language indicated, so no syntax highlighting. 
But let's throw in a <b>tag</b>.
Enter fullscreen mode Exit fullscreen mode

Table

Tables are not part of the core Markdown spec, but they are part or GitHub Flavored Markdown (GFM) and Markdown Here supports them. Table cell alignment might not work on all sites that supports Tables

Colons can be used to align columns.

| Tables        | Are           | Nice |
| ------------- |:-------------:| -----:|
| item 3 is     | right-aligned | $2500 |
| item 2 is     | centered      |   $89 |
| alternate row | are neat      |    $6 |

There must be at least 3 dashes separating each header cell.
The outer pipes (|) are optional, and you don't need to make the 
raw Markdown line up prettily. You can also use inline Markdown.

Markdown | Not | Pretty
--- | --- | ---
*but* | `renders` | **perfectly**
1 | 2 | 3
Tables Are Nice
item 3 is right-aligned $2500
item 2 is centered $89
alternate row are neat $6
Markdown Not Pretty
but renders perfectly
1 2 3

There are some features which might not work on some platforms because there are different flavors (versions) of markdown. Every Markdown application implements a slightly different version of Markdown.
For details please refer the particular version of application you are using.

Heroku

Amplify your impact where it matters most — building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

If this post resonated with you, feel free to hit ❤️ or leave a quick comment to share your thoughts!

Okay