LaTeX and code highlighting sample
This post is a smoke test for two features that this blog supports out of the box: LaTeX math rendered by KaTeX, and code blocks highlighted by Shiki.
Inline and block math
The Pythagorean theorem can be written inline as .
For a longer expression, use a display block:
Matrices and aligned equations also render correctly:
Code highlighting
A small TypeScript snippet:
type Post = {
title: string;
publishedAt: Date;
};
export const isRecent = (post: Post): boolean => {
const oneWeek = 7 * 24 * 60 * 60 * 1000;
return Date.now() - post.publishedAt.getTime() < oneWeek;
};
And a Python equivalent:
from datetime import datetime, timedelta
def is_recent(published_at: datetime) -> bool:
return datetime.now() - published_at < timedelta(days=7)