Chapter 2: Advanced Features
Deep dive into advanced markdown features and reusable MDX components: callouts, tabs, steps, quotes, pros/cons, link cards, video embeds, math, and syntax highlighting.
In this chapter, we’ll explore advanced markdown features and a reusable MDX component system that make technical documentation shine.
Warning the Reader (Gracefully)
Sometimes you need to grab the reader’s attention quickly. Maybe a dependency is deprecated, or there is a security vulnerability they should be aware of. Instead of bold text, we use a universal <Callout /> component.
Interactive Installation Guides
Top-tier docs offer npm, pnpm, and yarn installation options. With our custom <Tabs> component, providing this is frictionless:
bash frame="terminal" npm install @astrojs/mdx astro-expressive-code
bash frame="terminal" pnpm add @astrojs/mdx astro-expressive-code
bash frame="terminal" yarn add @astrojs/mdx astro-expressive-code
Following the Process
Instead of a standard unordered list, the <Steps> component renders a clear vertical timeline for tutorials:
Initialize your project Run npm create astro@latest and choose the
blog template to instantly scaffold a highly optimized site.
Add MDX Run npx astro add mdx to install the official MDX integration
into your content layer.
Write components Drop reusable .astro components into
src/components/ui/ and import them inside any .mdx chapter.
Code Syntax Highlighting
Code fences support titles, line highlights, diff markers, and a copy button — powered by Expressive Code.
Astro Page with Highlights
---import Layout from '../layouts/Layout.astro';import { getCollection } from 'astro:content';const posts = await getCollection('post');const drafts = posts.filter(p => !p.data.published);const all = posts;---<Layout title="Welcome"> <main><h1>Hello World</h1></main></Layout>MDX is a format that lets you seamlessly write JSX in your Markdown documents. You can import components, such as interactive charts or alerts, and embed them within your content.
Mathematics (KaTeX)
Calculus
Taylor Series Expansion:
Fourier Transform:
Inverse Fourier Transform:
Tables
Feature Comparison Matrix
| Feature | PyTorch | TensorFlow | JAX | NumPy |
|---|---|---|---|---|
| Dynamic Graph | ✅ | ⚠️ (TF 2.x) | ✅ | N/A |
| GPU Support | ✅ | ✅ | ✅ | ⚠️ (via CuPy) |
| AutoDiff | ✅ | ✅ | ✅ | ❌ |
| TPU Support | ❌ | ✅ | ✅ | ❌ |
| Production | ⚠️ | ✅ | ⚠️ | ❌ |
| Research | ✅ | ⚠️ | ✅ | ✅ |
| Learning Curve | Easy | Moderate | Hard | Easiest |
Highlighting Information
When reviewing frameworks or methodologies, a ProsCons list is invaluable for letting your readers digest the trade-offs quickly:
- Visually striking pages out-of-the-box
- Higher reader engagement
- Enforces consistent design system
- Slightly increases initial build time
- Authors must remember component syntax
Sometimes explaining complex architectural concepts requires video. The <YouTube> embedder is zero-layout-shift and lazy-loaded:
When referencing external documentation, prefer a <LinkCard> over a bare hyperlink:
Sidenotes
Gradient descent Gradient descent is an optimization algorithm used to minimize a function by iteratively moving in the direction of steepest descent — the negative of the gradient. is the foundation of modern deep learning.
The learning rate The learning rate controls how much to adjust the model in response to the estimated error each step. Typical values: 0.001, 0.01, 0.1. is one of the most important hyperparameters.
Further Reading
- KaTeX Documentation — math syntax reference
- Astro MDX — official MDX integration
Discussion
Sign in with GitHub to comment or react. Powered by giscus.