163 lines
No EOL
3.5 KiB
Markdown
163 lines
No EOL
3.5 KiB
Markdown
thumb: https://picsum.photos/id/237/200/300
|
|
title: Comprehensive Markdown & GFM Syntax Reference
|
|
desc: A detailed guide to Markdown and GitHub Flavored Markdown (GFM) syntax, covering text formatting, lists, tables, code blocks, links, and footnotes.
|
|
date: 2026-05-27
|
|
tags: [markdown, gfm, syntax, reference, guide]
|
|
draft: true
|
|
^---
|
|
|
|
## 1. Text Formatting & Structure
|
|
|
|
* **Bold:** **This text is bold** or __this is bold__.
|
|
* **Italic:** *This text is italic* or _this is italic_.
|
|
* **Strikethrough (GFM):** ~~This text is crossed out.~~
|
|
* **Combined:** ***This text is bold and italic***.
|
|
* **Inline Code:** Use single backticks for `console.log("Hello World")` inline.
|
|
|
|
### Hierarchy Example
|
|
> **Blockquotes:** Use blockquotes to highlight quotes, notes, or warnings.
|
|
>
|
|
> "The best way to predict the future is to invent it."
|
|
> > Nested blockquotes are supported by adding an extra `>`.
|
|
|
|
---
|
|
|
|
## 2. Lists
|
|
|
|
### Unordered (Bulleted)
|
|
* Item 1
|
|
* Nested Item 1.1
|
|
* Nested Item 1.2
|
|
* Item 2
|
|
|
|
### Ordered (Numbered)
|
|
1. First item
|
|
2. Second item
|
|
1. Nested ordered item
|
|
2. Another nested item
|
|
3. Third item
|
|
|
|
### Task Lists (GFM)
|
|
- [x] Write the Markdown test template
|
|
- [ ] Implement features in production
|
|
- [ ] Review documentation
|
|
|
|
---
|
|
|
|
## 3. Tables (GFM)
|
|
|
|
| Feature | Standard Markdown | GFM Extension | Status |
|
|
| :--- | :---: | :---: | ---: |
|
|
| Tables | ✗ | ✓ | Implemented |
|
|
| Task Lists | ✗ | ✓ | Implemented |
|
|
| Autolinks | ✗ | ✓ | Native |
|
|
| Strikethrough | ✗ | ✓ | Implemented |
|
|
|
|
---
|
|
|
|
## 4. Code Blocks with Syntax Highlighting
|
|
|
|
```bash
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Variables & string manipulation
|
|
NAME="world"
|
|
GREETING="Hello, ${NAME}!"
|
|
UPPER=${GREETING^^}
|
|
SLICE=${GREETING:0:5}
|
|
echo "$UPPER | $SLICE"
|
|
|
|
# Arrays
|
|
FRUITS=(apple banana cherry)
|
|
FRUITS+=(mango)
|
|
echo "${FRUITS[@]}" # all elements
|
|
echo "${#FRUITS[@]}" # length
|
|
echo "${FRUITS[@]:1:2}" # slice
|
|
|
|
# Associative array
|
|
declare -A CONFIG=([host]="localhost" [port]="8080")
|
|
echo "${CONFIG[host]}:${CONFIG[port]}"
|
|
|
|
# Arithmetic
|
|
COUNT=0
|
|
(( COUNT += 5 ))
|
|
RESULT=$(( COUNT ** 2 ))
|
|
echo "$RESULT"
|
|
|
|
# Conditionals & test operators
|
|
FILE="/etc/hosts"
|
|
if [[ -f "$FILE" && -r "$FILE" ]]; then
|
|
echo "readable"
|
|
elif [[ -e "$FILE" ]]; then
|
|
echo "exists but not readable"
|
|
else
|
|
echo "not found"
|
|
fi
|
|
|
|
# Case
|
|
case "$NAME" in
|
|
world|earth) echo "planet" ;;
|
|
*) echo "unknown" ;;
|
|
esac
|
|
|
|
# Loops
|
|
for fruit in "${FRUITS[@]}"; do
|
|
echo "fruit: $fruit"
|
|
done
|
|
|
|
for (( i=0; i<3; i++ )); do
|
|
echo "i=$i"
|
|
done
|
|
|
|
WHILE=3
|
|
while (( WHILE-- > 0 )); do
|
|
echo "while: $WHILE"
|
|
done
|
|
|
|
# Functions with local vars & return codes
|
|
greet() {
|
|
local name=${1:-"stranger"}
|
|
local -r greeting="Hi, $name!"
|
|
echo "$greeting"
|
|
return 0
|
|
}
|
|
greet "$NAME"
|
|
|
|
# Command substitution & process substitution
|
|
DATE=$(date +%Y-%m-%d)
|
|
DIFF=<(echo "foo")
|
|
echo "Today: $DATE"
|
|
|
|
# Here-doc
|
|
cat <<EOF
|
|
Multiline
|
|
text block
|
|
EOF
|
|
|
|
# Pipelines, redirection & traps
|
|
trap 'echo "exiting"; exit 1' ERR
|
|
echo "hello" | tr '[:lower:]' '[:upper:]' > /dev/null 2>&1
|
|
|
|
# Parameter expansion: default, error, replace
|
|
echo "${UNSET:-default}"
|
|
echo "${GREETING/Hello/Hey}"
|
|
echo "${FILE##*/}" # basename
|
|
echo "${FILE%/*}" # dirname
|
|
```
|
|
|
|
---
|
|
|
|
## 5. Links and Autolinks
|
|
|
|
* **Standard Link:** [Search Engine](https://www.google.com)
|
|
* **Link with Tooltip:** [GitHub](https://github.com "Go to GitHub")
|
|
* **Autolink (GFM):** https://nixos.org
|
|
|
|
---
|
|
|
|
## 6. Footnotes (GFM)
|
|
|
|
You can reference a footnote at the end of a sentence[^1].
|
|
|
|
[^1]: This is the text of the footnote, which typically renders at the bottom of the document. |