.md Markdown File Demo
Explore how Markdown files work in Astro
By Astro Developer β’ 2025-06-16T00:00:00.000Z
Markdown in Astro
Welcome to the Markdown demo page! This page is written entirely in Markdown and demonstrates how Astro seamlessly transforms .md files into full HTML pages.
π What is Markdown?
Markdown is a lightweight markup language that allows you to write content using plain text formatting. Astro converts your Markdown files into HTML at build time, making it perfect for:
- Blog posts
- Documentation
- Content-heavy pages
- Static content that doesnβt need complex interactivity
π Frontmatter
At the top of this file, youβll notice the frontmatter section between the --- markers. This YAML data is accessible in your layout and can include:
---
layout: 'src/layouts/Layout.astro'
title: 'Page Title'
description: 'Page description'
author: 'Author Name'
date: 2025-06-16
tags: ['tag1', 'tag2']
---
π¨ Markdown Features
Text Formatting
You can use all standard Markdown formatting:
- Bold text with
**text** - Italic text with
*text* - Bold and italic with
***text*** Strikethroughwith~~text~~Inline codewith backticks
Lists
Unordered Lists
- First item
- Second item
- Nested item
- Another nested item
- Third item
Ordered Lists
- First step
- Second step
- Sub-step A
- Sub-step B
- Third step
Links and Images
Create links to other pages or external sites.
While images work in Markdown, for this demo weβll use emoji instead: π π β‘
Blockquotes
βThe best way to predict the future is to invent it.β
β Alan Kay
Code Blocks
// JavaScript example
function greet(name) {
return `Hello, ${name}! Welcome to Astro.`;
}
console.log(greet('Developer'));
---
// Astro component example
const items = ['Astro', 'Markdown', 'Components'];
---
<ul>
{items.map(item => <li>{item}</li>)}
</ul>
Tables
| Feature | Markdown | MDX | Astro |
|---|---|---|---|
| Plain text content | β | β | β |
| Component imports | β | β | β |
| JavaScript expressions | β | β | β |
| Scoped styles | β | β | β |
Horizontal Rules
Use three or more hyphens, asterisks, or underscores:
π§ Markdown Configuration
Astro uses remark and rehype under the hood, which means you can:
- Add custom remark/rehype plugins
- Configure syntax highlighting
- Enable GitHub Flavored Markdown
- Add custom components via MDX
π When to Use Markdown
Markdown files are perfect when you:
- Need to write content quickly
- Want to focus on writing without HTML distractions
- Are building a blog or documentation site
- Have content writers who arenβt familiar with HTML/JSX
π― Limitations
While powerful, Markdown files in Astro have some limitations:
- No dynamic JavaScript (use MDX for that)
- No component imports (use MDX for that)
- Limited styling options (relies on global CSS or layout styles)
π Navigation
This page was generated from a .md file. View the source to see the Markdown syntax in action!