Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Yaml Cheatsheet #147

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions CheatSheets/YAML.-cheetsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Always indent with two spaces.

### ```term: value``` — Objects

- Start with a term, no spaces, followed by a colon and a space.
```Yaml
name: "Tyrannosaurus"
period: "Late Cretaceous"
```
- Indent to create nested objects.
```Yaml
dimensions:
width: "3 metres"
height: "8 metres"
```
### ```value``` — Arrays

Start with a dash, and a space.
```Yaml
- "Other dinosaurs"
- "Meat"
```
### Arrays inside objects:
```Yaml
likes_to_eat:
- "Other dinosaurs"
- "Meat"
```
### Objects inside arrays.
```Yaml
- name: "T. rex"
period: "Late Cretaceous Period"
```
### ```" ```— Escaping
Surround text with quotes (double or single) to escape text.
```Yaml
name_meaning: "tyrant & lizard"
```
- In all the previous examples the quotes aren’t really necessary. But I find myself almost always adding them for clarity and to prevent myself from having to think about whether I need to escape them or not.
### ```>``` — Folded text block

- Start with a greater than, and indent the next lines.

- The text will be collapsed into a single line when parsed.
```Yaml
desc: >
Tyrannosaurus is a genus of coelurosaurian theropod dinosaur.
The species Tyrannosaurus rex is one of the most well-represented of the large theropods.
```
### ```|``` — Wrapped text block

- Start with a vertical pipe, and indent the next lines.

- The text will keep its multiple lines when parsed.
```Yaml
poem: |
T. rex, T.rex
How I love thee
```
### ```---``` — Front matter
YAML can be used at the top of Markdown documents to add more structured data.
Surround the YAML with two lines of consecutive dashes.
```Yaml
---
name: "Venus"
discoverer: "Galileo Galilei"
---
*Venus* is the second planet from the Sun, orbiting it every 224.7 Earth days.
```
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ This `CHEATSHEETS FOR DEVELOPERS` list has been made to enhance the workflow and
| 43 | VueJS | VueJS CheatSheet | <a href="./CheatSheets/vuejs-cheatsheet.md">Click Here</a> |
| 44 | Windows | Windows Shortcuts CheatSheet | <a href="./CheatSheets/windows-cheatsheet.md">Click Here</a> |
| 45 | Windows Terminal | Windows Terminal Commands CheatSheet | <a href="./CheatSheets/windows-terminal-cheatsheet.md">Click Here</a> |
| 46 | Yaml | Yaml basics Cheatsheet | <a href="./CheatSheets/YAML.-cheetsheet.md">Click Here</a> |

---

Expand Down