800 words
4 minutes
Học Markdown: Từ Cơ Bản Đến Nâng Cao - Hướng Dẫn Toàn Diện
📖 Học Markdown: Từ Cơ Bản Đến Nâng Cao
Markdown là ngôn ngữ đánh dấu đơn giản nhưng mạnh mẽ, được sử dụng rộng rãi trong documentation, blog, GitHub, và nhiều platform khác. Hướng dẫn này sẽ giúp bạn master Markdown từ cơ bản đến nâng cao.
🤔 Tại Sao Nên Học Markdown?
Ưu Điểm
- ✅ Đơn giản: Syntax dễ học và nhớ
- ✅ Universal: Được hỗ trợ ở khắp nơi
- ✅ Fast: Viết nhanh hơn HTML
- ✅ Readable: Dễ đọc cả ở dạng raw text
- ✅ Version Control Friendly: Git-friendly format
Sử Dụng Ở Đâu?
- GitHub/GitLab: README, Issues, Wiki
- Documentation: Technical docs, API docs
- Blogs: Static site generators (Astro, Jekyll, Hugo)
- Note-taking: Obsidian, Notion, Roam Research
- Chat: Discord, Slack, Microsoft Teams
📝 Phần 1: Markdown Cơ Bản
1.1 Headers (Tiêu Đề)
Markdown sử dụng ký hiệu #
để tạo headers:
# H1 - Tiêu đề cấp 1## H2 - Tiêu đề cấp 2### H3 - Tiêu đề cấp 3#### H4 - Tiêu đề cấp 4##### H5 - Tiêu đề cấp 5###### H6 - Tiêu đề cấp 6
💡 Tip: Luôn để space sau # và tránh skip levels (H1 → H3)
1.2 Text Formatting (Định Dạng Text)
**Bold text** hoặc __Bold text__*Italic text* hoặc _Italic text_***Bold và italic*** hoặc ___Bold và italic___~~Strikethrough text~~`Inline code`
Kết quả:
- Bold text
- Italic text
- Bold và italic
Strikethrough textInline code
1.3 Lists (Danh Sách)
Unordered Lists
- Item 1- Item 2 - Nested item 2.1 - Nested item 2.2- Item 3
Ordered Lists
1. First item2. Second item 1. Nested item 2.1 2. Nested item 2.23. Third item
Task Lists
- [x] Completed task- [ ] Incomplete task- [ ] Another task
1.4 Links và Images
Links
[Link text](https://example.com)[Link với title](https://example.com "Hover title")<https://example.com>
Images

1.5 Blockquotes
> Đây là blockquote>> Có thể nhiều dòng
1.6 Code Blocks
Inline Code
Sử dụng `const variable = value` trong JavaScript.
Fenced Code Blocks
```javascriptfunction hello() { console.log("Hello World!");}```
1.7 Horizontal Rules
---hoặc***hoặc___
🚀 Phần 2: Markdown Nâng Cao
2.1 Tables (Bảng)
| Header 1 | Header 2 | Header 3 ||----------|----------|----------|| Row 1 | Data | Data || Row 2 | Data | Data |
Alignment:| Left | Center | Right ||:-----|:------:|------:|| L1 | C1 | R1 || L2 | C2 | R2 |
2.2 Mathematical Expressions
Inline Math
This is inline math: $E = mc^2$
Block Math
$$\frac{n!}{k!(n-k)!} = \binom{n}{k}$$
2.3 HTML trong Markdown
<details><summary>Click để expand</summary>
Nội dung ẩn ở đây.
</details>
<kbd>Ctrl</kbd> + <kbd>C</kbd>
🎯 Phần 3: Best Practices
3.1 Formatting Guidelines
Headers
✅ Tốt:# Main Title## Section### Subsection
❌ Tránh:#Main Title (thiếu space)
Lists
✅ Tốt:- Item 1- Item 2 - Nested item
❌ Tránh:-Item 1 (thiếu space)
3.2 Accessibility Tips
✅ Alt text cho images:
✅ Descriptive link text:[Read our guidelines](link)
❌ Tránh:[Click here](link)
🛠️ Phần 4: Tools và Editors
4.1 Markdown Editors
Desktop Editors
- Typora: WYSIWYG markdown editor
- Mark Text: Real-time preview
- Obsidian: Note-taking với linking
Online Editors
- StackEdit: Browser-based editor
- Dillinger: Online markdown editor
- HackMD: Collaborative editing
Code Editors
- VS Code: Extensions như Markdown All in One
- Sublime Text: Markdown plugins
4.2 Useful VS Code Extensions
- Markdown All in One- Markdown Preview Enhanced- markdownlint- Paste Image- Markdown Table Formatter
📚 Phần 5: Markdown Variants
5.1 GitHub Flavored Markdown (GFM)
Additions to standard markdown:- Task lists: - [x] Done- Tables: | Header | Data |- Strikethrough: ~~text~~- Auto-linking: https://github.com- Emoji: :smile:- Syntax highlighting
5.2 Platform-Specific Features
Discord
**Bold** *Italic* __Underline__~~Strikethrough~~ ||Spoiler||`Code` ```Code block```> Quote
🔧 Phần 6: Troubleshooting
6.1 Common Issues
Line Breaks
❌ Problem: Text không xuống dòng✅ Solution: End line với 2 spacesHoặc dùng empty line
Special Characters
❌ Problem: *text* bị italic✅ Solution: \*text\* (escape với backslash)
Tables Not Rendering
❌ Problem:|Header|Data|------|----
✅ Solution:| Header | Data ||--------|------|| Row | Data |
🚀 Phần 7: Practical Examples
7.1 Blog Post Template
---title: "Post Title"date: 2025-06-07tags: ["tag1", "tag2"]---
# Post Title
Brief introduction.
## What You'll Learn
- Key point 1- Key point 2- Key point 3
## Section 1
Content với examples...
### Code Example
```languagecode here
Conclusion
Summary và call-to-action.
Tags: #tag1 #tag2
### 7.2 README Template
```markdown# Project Name
Brief description.
## Installation
```bashnpm install project-namenpm start
Features
- Feature 1
- Feature 2
- Upcoming feature
Contributing
- Fork repository
- Create feature branch
- Commit changes
- Create Pull Request
License
MIT License
## 📋 Cheat Sheet
```markdown# Headers## Headers
**Bold** *Italic* ~~Strike~~ `Code`
- Bullet list1. Numbered list- [x] Task list
[Link](url) 
> Blockquote
```code block```
| Table | Data ||-------|------|
---
<!-- Comment -->
Escape: \*literal\*
🎯 Bài Tập Thực Hành
Beginner
- Tạo personal profile README
- Viết documentation cho project nhỏ
- Format một bài blog từ plain text
Intermediate
- Tạo comprehensive project README
- Viết API documentation với examples
- Sử dụng advanced features (tables, math)
Advanced
- Setup static site với Markdown
- Custom Markdown renderer
- Automation workflow cho documentation
💡 Remember: Markdown là tool, không phải mục đích. Focus vào content quality và reader experience!
🚀 Next Step: Áp dụng ngay những gì học được để viết blog post đầu tiên với Markdown!
Học Markdown: Từ Cơ Bản Đến Nâng Cao - Hướng Dẫn Toàn Diện
https://hung2124.github.io/blog/posts/hoc-markdown-co-ban-den-nang-cao/