Background
Leo Pagano
Blog Demonstration

Blog Demonstration

May 13, 2025
4 min read
Table of Contents
index

Markdown Basics

Body text

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Headings

The quick brown fox jumped over the lazy dog.

The quick brown fox jumped over the lazy dog.

The quick brown fox jumped over the lazy dog.

The quick brown fox jumped over the lazy dog.

The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.

Headings appear in the Table of Contents for that blog post.

Formatting

This text is bold. This text is italic. Note: Markdown reserves underlining for links, so you can’t underline text otherwise.

Blockquotes

This is a blockquote.

This is a nested blockquote.

Lists

Unordered Lists

  • Unordered list items…
    • …can be made with (*)
    • …or with (-)
  • But don’t mix and match in the same list.

Ordered Lists

  1. 1st ordered list item
  2. 2nd ordered list item
  3. 3rd ordered list item

Markdown supports links, too.

Rich Markdown Content

Code

Code can be written inline, i.e. getState(), or in blocks, where you can (with MDX) do any of the following;

  • Declare a language used, to provide color to the code
  • Collapse verbose lines of code, allowing them to be made visible with a click of a button
  • (Optionally) show line numbers
  • Highlight certain important line(s) of code
  • And more!
src/lib/data-utils.ts
import { getCollection, type CollectionEntry } from 'astro:content'
export async function getAllPosts(): Promise<CollectionEntry<'blog'>[]> {
4 collapsed lines
const posts = await getCollection('blog')
return posts
.filter((post) => !post.data.draft)
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf())
}

Math

Much like code, math can also be written inline; A=πr2A = \pi r^2, or in blocks:

f(x)=n=0f(n)(a)(xa)nn!f(x) = \sum^{\infty}_{n=0} f^{(n)}(a) \frac{(x-a)^n}{n!}

Images

You can embed images in Markdown:

Dramatic sky pic

Videos

I do not recommend adding video files to the source tree (or in Markdown) due to their sheer size. Instead, I recommend using YouTube or a similar hosting service. YouTube videos can be embedded by copying the HTML embed code directly into the MDX file. If given width and height parameters in your <iframe>, replace them with class="w-full aspect-video" to ensure they do not overflow on small screens.

MDX Components

Callouts

Place these at the top of the MDX file:

index.mdx
import Callout from '@/components/Callout.astro'
import { Icon } from 'astro-icon/components'

Then, use the <Callout> tag:

Important (An important callout)

Look! This text is inside a callout! You can do ordinary Markdown stuff, like math…

x=b±b24ac2ax = \frac{-b \pm \sqrt{ b^2-4ac }}{2a}

…or code…

import csv
import hashlib
import random
import shutil
import subprocess
import time
import uuid
from pathlib import Path

Several types of callouts exist. These include, but are not limited to:

VariantUsage
NoteFor general information or comments that don’t fit other categories
TipFor helpful advice or shortcuts related to the topic at hand
WarningFor potential pitfalls or common misconceptions
DangerFor things that could potentially be destructive or harmful
ImportantFor things that are important to the reader’s understanding

A full list of these callouts can be seen in the Callout.astro file.

Keyboard Keys

You can add keyboard keys that look like real keys using the <kbd> tag. For example, Ctrl+Alt+Del.