Hello, MDX
How this blog works, and a tour of the building blocks every post can use.
Also available in: Srpski
Every post on this site is a plain .mdx file: Markdown for the prose, React components for everything else.
Code#
Fenced blocks are highlighted automatically and get a copy button:
type Post = { slug: string; title: string };
export function byTitle(posts: Post[]) {
return [...posts].sort((a, b) => a.title.localeCompare(b.title));
}Need a filename in the title bar? Use the component directly:
export const site = {
name: "Milan Pantelić",
languages: ["en", "sr"],
};Callouts#
Steps#
- Create the postAdd a file under
src/content/blog/named after the language. - Add frontmatterTitle, date, category, and optional tags.
- TranslateDrop an
sr.mdxnext to it. Same folder, new language.
Images#
Everything else#
A collapsible section
Good for long output, optional detours, or spoilers.
The format behind all of this.
| Component | Use it for |
|---|---|
Callout | Notes, tips, warnings |
Figure | Images with captions |
Steps | Ordered how-to sequences |
LinkCard | Rich external links |