Writing Articles Here — Markdown, Code and Math

2 min readAstroMarkdownKaTeX

The source of this site is on GitHub at yutaro-sakamoto/yutaro-sakamoto.github.io.

Articles are plain Markdown (or MDX) files under src/data/blog/en/ (src/data/blog/ja/ for the Japanese versions). This post doubles as a reference for the available syntax.

Frontmatter

Every article starts with frontmatter:

---
title: "Title of the article"
description: "Used on the index page and for social cards"
pubDate: 2026-08-22
updatedDate: 2026-08-23 # optional
tags: ["Astro", "Markdown"]
draft: false # true keeps it out of production builds
math: true # set for posts containing TeX
---

The schema is validated with Zod in src/content.config.ts, so a missing field fails the build instead of shipping a broken page.

Code

Code blocks are highlighted at build time by Shiki — no client-side JavaScript involved.

fn main() {
    let cobol_files: Vec<_> = std::env::args()
        .skip(1)
        .filter(|p| p.ends_with(".cbl"))
        .collect();

    for path in &cobol_files {
        println!("parsing {path}");
    }
}
       IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLO.
       PROCEDURE DIVISION.
           DISPLAY "HELLO, WORLD".
           STOP RUN.

Math

Math is written in TeX and rendered to HTML by KaTeX during the build.

Inline math goes between $...$: the generalized Petersen graph GP(n,k)GP(n, k) has 2n2n vertices.

Display math goes between $$...$$:

χ(G)Δ(G)+1\chi'(G) \le \Delta(G) + 1

Environments work as expected:

vV(G)deg(v)=2E(G)i=1nAi=S[n](1)S+1iSAi\begin{aligned} \sum_{v \in V(G)} \deg(v) &= 2\,|E(G)| \\ \left| \bigcup_{i=1}^{n} A_i \right| &= \sum_{\emptyset \ne S \subseteq [n]} (-1)^{|S|+1} \left| \bigcap_{i \in S} A_i \right| \end{aligned} f(n)={1(n=0)nf(n1)(n1)A=(1001)f(n) = \begin{cases} 1 & (n = 0) \\ n \cdot f(n-1) & (n \ge 1) \end{cases} \qquad A = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}

Everything else

GitHub Flavored Markdown is enabled, so tables and task lists work too.

DishTimeNotes
Curry40 minEven better the next day
Miso soup10 minDo not boil it after adding miso
Fried chicken30 minFry it twice for a crisp coating

Blockquotes are available as well.

  • An open task
  • A finished task

Publishing

Add the Markdown file, push to main, and GitHub Actions builds and deploys the site to GitHub Pages. To preview locally:

npm install
npm run dev
Back to all articles