astrobench · play with code
Step
2/10

Add some Markdown

Mission Control needs a way to publish updates. Write prose.

So far you've written HTML in .astro files. Fine for buttons. Awful for prose.

 

For posts you want Markdown . Headings with ## , italics with underscores, links in brackets. Astro reads .md files natively.

 

Drop the post in a new src/content/logs/ folder:

src/content/logs/launch-day.md — Markdown file read-only
1
2
3
4
5
6
7
8
9
10
11
---
title: Launch day
date: 2026-10-14
author: Mae Jemison
---

## What happened

Ignition at T-0. Apollo 42 cleared the tower in 8 seconds.

The booster sep was on the nose. Mission Control breathed a long, deep breath.

Then a regular Astro page imports it. Markdown files give you two things: frontmatter (the YAML on top, as data) and Content (a component that renders the body).

src/pages/logs/launch-day.astro read-only
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
import Layout from "~/layouts/Layout.astro";

// markdown files are real ES modules.
// frontmatter is exported as `frontmatter`.
import { frontmatter, Content } from "~/content/logs/launch-day.md";
---

<Layout title="Launch day">
  <article>
    <h1>{frontmatter.title}</h1>
    <p class="byline">
      {frontmatter.author} · {frontmatter.date}
    </p>
    <Content />
  </article>
</Layout>

Visit /logs/launch-day . The Markdown renders as proper HTML — paragraphs, headings, the lot. Writing > coding for content.

— page 2 —
in the binder open binder →
saved a moment ago
progress 20%
earn +70 XP