← Blog

Syntax Guideline

Complete reference for every feature this blog supports — callouts, diagrams, math, interactive charts, runnable Python, GitHub cards, encrypted posts, and more, all in one place.

Basic Text

Bold, italic, strikethrough, inline code, and links.

Blockquote:

“We don’t write because we want to; we write because we have to.” — and sometimes just so future-me doesn’t have to google it again.


Headings

# H1 — page title (used once)
## H2 — main section
### H3 — subsection
#### H4 — rarely needed

Lists

Unordered:

  • First item
  • Second item
    • Nested
    • Also nested

Ordered:

  1. Build with Astro
  2. Push to GitHub
  3. Auto-deploy via GitHub Actions

Task list:

  • Callouts
  • Mermaid diagrams
  • KaTeX math
  • Runnable Python
  • Write more posts

Footnotes work too1.


Tables

HostFree tierEdge CDNNotes
CloudflareFastest, most generous
VercelGreat DX
GitHub PagesGood for static blogs

Code Blocks

Plain block:

def fib(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return a

With filename and line highlight:

greet.ts
export function greet(name: string): string {
return `Hello, ${name}!`; // highlighted line
}

Diff block:

astro.config.mjs
export default defineConfig({
output: 'server',
output: 'static',
});

Callouts / Admonitions

Two syntaxes — ::: style:

Note

This is a note. Supports code, italic, and links.

Custom title

Set any title inside the square brackets.

Warning

Something risky lives here.

Important

Don’t forget this.

Caution

Deep water — don’t try to parse HTML with regex.

GitHub-flavoured blockquote style:

Note

Works the same as :::note but mirrors GitHub’s own markdown.

Warning

Be careful: this can delete data if run against the wrong environment.

Important

Set your environment variables before deploying.

Caution

Last chance before something breaks.


Mermaid Diagrams

Flowchart:

flowchart LR
  A[Markdown] --> B{remark}
  B -->|directive| C[Admonition]
  B -->|mermaid| D[Diagram]
  B --> E[rehype + KaTeX]
  C & D & E --> F[(Static HTML)]

Sequence diagram:

sequenceDiagram
  participant U as Browser
  participant CDN
  U->>CDN: GET /blog/a-post
  CDN-->>U: Static HTML (prebuilt)
  Note over U,CDN: 0 server runtime

Math (KaTeX)

Inline: the average complexity of quicksort is O(nlogn)O(n \log n).

Euler’s identity: eiπ+1=0e^{i\pi} + 1 = 0.

Block — sigmoid function (used in logistic regression and neural nets):

y^=σ ⁣(i=1nwixi+b),σ(z)=11+ez\hat{y} = \sigma\!\left( \sum_{i=1}^{n} w_i x_i + b \right), \quad \sigma(z) = \frac{1}{1 + e^{-z}}

Gaussian integral:

ex2dx=π\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}

Interactive Chart


GitHub Repo Cards

Embed a repo with live star/fork counts:

withastro/astroLoading from GitHub… saicaca/fuwariLoading from GitHub…

Terminal Recording (Asciinema)


Runnable Python (Pyodide / WASM)

Code blocks with run execute right in the browser — no backend, no server. First run downloads the Pyodide runtime (~6 MB, cached afterwards).

python
print("Hello from Python, running in your browser!")

def fib(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a

print("First 10 Fibonacci numbers:")
print([fib(i) for i in range(10)])

Standard library is included:

python
import math, statistics

data = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]
print("mean   :", round(statistics.mean(data), 3))
print("stdev  :", round(statistics.pstdev(data), 3))
print("sqrt 2 :", math.sqrt(2))

Errors are caught and displayed — try editing a block to raise one.


Encrypted Posts

Add a password field to any post’s frontmatter:

src/content/blog/my-secret.md
---
title: "Secret notes"
description: "..."
date: 2026-01-01
tags: [private]
password: mysecretpassword
---

At build time, the content is encrypted with AES-GCM (PBKDF2 key derivation, 150 000 iterations). The published HTML contains only ciphertext — the browser decrypts it on the correct password, without any server round-trip.

Footnotes

  1. Like this little note at the bottom of the page.

Comments

💬 Giscus is not configured — fill in repo / repoId / categoryId in src/components/GiscusComments.astro (get them from giscus.app ).