Hexo Blogging Cheatsheet

Hexo Blogging Cheatsheet

  1. Admonition Blocks

Admonition Blocks

example - Code Examples

💻 Configuration Example

---
title: My Blog Post
date: 2025-01-15
category: Development
tags: [Git, DevOps]
excerpt: "A concise description of the post content..."
---

Advanced Formatting Inside Blocks

Code Block Inside Admonition

🔧 Git Configuration

Set up your Git identity:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Table Inside Admonition

💡 Port Ranges

| OS | Range | Count | |---|---|---| | Linux | 32768-60999 | 28232 | | Windows | 49152-65535 | 16384 | | macOS | 49152-65535 | 16384 |

Nested Formatting

❌ Common Pitfalls

Avoid these mistakes:

  1. Hardcoded paths

    // ❌ Bad
    const path = 'C:\\Users\\neo\\file.txt';
    

    // ✅ Good
    const path = require(‘path’).join(__dirname, ‘file.txt’);

  2. Missing error handling

    • Always use try-catch blocks
    • Validate user input
    • Log errors properly
  3. Ignoring async/await

    Callbacks lead to "callback hell". Use modern async patterns.

Share