Here are the parts of markdown that I use most often.
For each example, the markdown code is shown first, and the rendered result is shown below.
Surround with **two asterisks for strong/bold**.
Surround with two asterisks for strong/bold.
Surround with _underscores for emphasis/italic_.
Surround with underscores for emphasis/italic.
[Put link titles in square brackets](https://gist.github.com/raghubetina/a1b6e89e24a8c3acae6f0b63a1fd3323#links) and link targets in parentheses following the closing square bracket.
Put link titles in square brackets and link targets in parentheses following the closing square bracket.
For bulleted lists — one space, followed by a dash, followed by a space, and then the item:
- First bullet
- Second bullet
- etc
For bulleted lists — a dash, followed by a space, and then the item:
- First bullet
- Second bullet
- etc
For numbered lists — any number, followed by a dot, followed by a space, and then the item:
1. First point
1. Second point
1. etc
For numbered lists — any number, followed by a dot, followed by a space, and then the item:
- First point
- Second point
- etc
To nest something within the same list item, go to the next line and then indent by 4 spaces:
- I am a list item that has multiple paragraphs.
This is the second paragraph of the first list item.
You can have as many paragraphs as you want.
- This is the second list item.
- etc
To nest something within the same list item, go to the next line and then indent by 4 spaces:
-
I am a list item that has multiple paragraphs.
This is the second paragraph of the first list item.
You can have as many paragraphs as you want.
-
This is the second list item.
-
etc
Technically, you can use any number of spaces, not just 4; as long as it's more than what you indented the first level by. I use 4 to make nesting more visually clear than just using 2.
You can nest other lists within lists by indenting 8 spaces, 12 spaces, etc:
- Top level
- Second level
1. 3a
2. 3b
Another paragraph in 3b.
3. 3c
- Back out to second level.
Some explanatory text still in the very first bullet.
- Second top level bullet.
- etc
-
Top level
- Second level
-
3a
-
3b
Another paragraph in 3b.
-
3c
-
- Back out to second level.
Some explanatory text still in the very first bullet.
- Second level
-
Second top level bullet.
-
etc
# Heading level 1
## Heading level 2
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6
---
Use three dashes to...
---
... create separation with horizontal rules.
---
Use three dashes to...
... create separation with horizontal rules.
Highlight `variable` names, etc, in the middle of a line by `surrounding` it with backticks.
Highlight variable
names, etc, in the middle of a line by surrounding
it with backticks.
Start a code block with a line comprised of three backticks, followed optionally by the language (if you want syntax highlighting). End the code block with another line comprised of three backticks:
```ruby
class Person
attr_accessor :first_name
attr_accessor :last_name
def full_name
return self.first_name + " " + self.last_name
end
end
```
class Person
attr_accessor :first_name
attr_accessor :last_name
def full_name
return self.first_name + " " + self.last_name
end
end
> The person who chases two rabbits, catches neither.
>
> — Confucius
The person who chases two rabbits, catches neither.
— Confucius
You can use any other markdown within blockquotes:
> 1. First point
> 2. Second point
> 3. etc
>
> ```ruby
> class Person
> attr_accessor :first_name
> attr_accessor :last_name
>
> def full_name
> return self.first_name + " " + self.last_name
> end
> end
> ```
- First point
- Second point
- etc
class Person attr_accessor :first_name attr_accessor :last_name def full_name return self.first_name + " " + self.last_name end end
I don't bother trying to write markdown tables by hand; instead, I generate them:
- Excel to markdown: https://thisdavej.com/copy-table-in-excel-and-paste-as-a-markdown-table/
- Markdown table generator: https://www.tablesgenerator.com/markdown_tables
~~Strike something out~~ and replace it by surrounding it with two tildes.
Strike something out and replace it by surrounding it with two tildes.
On GitHub, you can make interactive task lists, which e.g. add handy counters to Issues and Pull Requests indicating your progress towards completing them:
- [x] Finish my changes
- [ ] Push my commits to GitHub
- [ ] Open a pull request
- Finish my changes
- Push my commits to GitHub
- Open a pull request
Task lists are not respected by most other Markdown parsers, other than GitHub's.
Sometimes it's useful to convert Rich Text (i.e. from Word, or copy-pasted from anywhere else really) into Markdown. Try this site for that.
Markdown Here is an incredibly useful browser extension that allows you to use Markdown in any text field — for example, within Gmail. (I use this extension a hundred times a day.)
I cannot wait to learn more about coding.