Markdown Guide
This comprehensive guide will help you master Markdown syntax for creating well-formatted documentation. Each section includes both the Markdown syntax and its rendered output.
Basic Syntax
1. Headings
Markdown provides six levels of headings, using #
symbols:
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
The rendered output looks like this:
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
2. Text Formatting
Bold Text
**Bold text** or __Bold text__
Italic Text
*Italic text* or _Italic text_
Bold and Italic
***Bold and italic*** or ___Bold and italic___
Strikethrough
~~Strikethrough text~~
3. Lists
Unordered Lists
- First item
- Second item
- Indented item
- Another indented item
- Third item
- First item
- Second item
- Indented item
- Another indented item
- Third item
Ordered Lists
1. First item
2. Second item
1. Indented item
2. Another indented item
3. Third item
- First item
- Second item
- Indented item
- Another indented item
- Third item
4. Links
Basic Links
[Visit GitHub](https://github.com)
Links with Titles
[GitHub](https://github.com "GitHub's Homepage")
Reference-style Links
[GitHub][1]
[DevOps][2]
[1]: https://github.com
[2]: https://en.wikipedia.org/wiki/DevOps
5. Images
Basic Image

Image with Title

6. Code
Inline Code
Use `git status` to list all changed files.
git status
to list all changed files.
Code Blocks
```python
def hello_world():
print("Hello, World!")
```
def hello_world():
print("Hello, World!")
Syntax Highlighting
```javascript
function greet(name) {
console.log(`Hello, ${name}!`);
}
```
function greet(name) {
console.log(`Hello, ${name}!`);
}
7. Tables
| Left-aligned | Center-aligned | Right-aligned |
|:-------------|:-------------:|-------------:|
| Content | Content | Content |
| Left | Center | Right |
Left-aligned | Center-aligned | Right-aligned |
---|---|---|
Content | Content | Content |
Left | Center | Right |
8. Blockquotes
Simple Blockquote
> This is a blockquote
This is a blockquote
Nested Blockquotes
> First level
>> Second level
>>> Third level
First level
Second level
Third level
9. Task Lists
- [x] Completed task
- [ ] Incomplete task
- [x] Completed subtask
- [ ] Incomplete subtask
- [x] Completed task
- [ ] Incomplete task
- [x] Completed subtask
- [ ] Incomplete subtask
10. Horizontal Rules
Any of these will create a horizontal rule:
---
***
___
11. Escaping Characters
Use backslash to escape special characters:
\* Not italic \*
\` Not code \`
\[ Not a link \]
* Not italic * ` Not code ` [ Not a link ]
12. Extended Syntax (with Material for MkDocs)
Highlighting Text
==Highlighted text==
Footnotes
Here's a sentence with a footnote[^1].
[^1]: This is the footnote.
Here's a sentence with a footnote[^1].
[^1]: This is the footnote.
Definition Lists
term
: definition
term : definition
Emoji
:smile: :heart: :thumbsup:
Best Practices
- Consistency: Use consistent formatting throughout your document
- Spacing: Add blank lines before and after headings
- Headers: Use proper header hierarchy (don't skip levels)
- Lists: Keep them simple and nested no more than three levels
- Code Blocks: Always specify the language for syntax highlighting
- Links: Use descriptive text rather than "click here"
- Images: Always include alt text for accessibility
Common Pitfalls to Avoid
- Forgetting to add two spaces for line breaks
- Incorrect nesting of lists
- Missing blank lines before and after lists and code blocks
- Improper escaping of special characters
- Inconsistent heading hierarchy
Tools and Resources
-
Markdown Editors:
- Visual Studio Code with Markdown extensions
- Typora
- StackEdit (web-based)
-
Online Validators:
-
Cheat Sheets: