A Markdown page in Astro is a simple text file using Markdown syntax to write content. Astro converts it into HTML for your website, making it easy to write and format text without coding HTML.
Click to reveal answer
beginner
What does MDX stand for and how is it different from Markdown?
MDX stands for Markdown + JSX. It lets you write Markdown content but also include interactive components (like buttons or widgets) inside your text, which normal Markdown cannot do.
Click to reveal answer
intermediate
How do you include a React component inside an MDX page in Astro?
You import the React component at the top of the MDX file and then use it like a tag inside the Markdown content. Astro processes this and renders the component where you placed it.
Click to reveal answer
intermediate
Why use MDX pages instead of plain Markdown in Astro projects?
MDX pages let you mix content and interactive UI components. This is great for tutorials, blogs, or docs where you want live examples or dynamic parts inside your text.
Click to reveal answer
beginner
What file extensions does Astro support for Markdown and MDX pages?
Astro supports .md for Markdown pages and .mdx for MDX pages. Use .md for simple content and .mdx when you want to add components inside your content.
Click to reveal answer
Which file extension should you use for a page that includes React components inside Markdown content in Astro?
What does MDX allow you to do that plain Markdown does not?
AAdd interactive components inside content
BWrite plain text only
CUse only HTML tags
DCreate CSS styles
✗ Incorrect
MDX lets you embed interactive UI components inside Markdown content.
In Astro, how do you import a component to use inside an MDX page?
AUse a script tag inside Markdown
BWrite the component code inside the MDX file
CComponents cannot be used in MDX
DUse an import statement at the top of the MDX file
✗ Incorrect
You import components at the top of the MDX file to use them inside the content.
Which of these is NOT a benefit of using MDX pages in Astro?
AWriting plain text faster than Markdown
BEmbedding live examples in blogs
CCreating dynamic documentation
DMixing content with interactive components
✗ Incorrect
MDX does not make writing plain text faster than Markdown; it adds interactivity.
What happens when Astro builds a Markdown (.md) page?
AIt runs JavaScript inside the Markdown
BIt ignores the file
CIt converts Markdown to HTML for the website
DIt converts Markdown to CSS
✗ Incorrect
Astro converts Markdown content into HTML to display on the website.
Explain how MDX pages enhance content in Astro compared to plain Markdown pages.
Think about mixing text and live parts in one file.
You got /4 concepts.
Describe the steps to use a React component inside an MDX page in Astro.
Focus on how to bring the component into the MDX file and use it.
You got /4 concepts.
Practice
(1/5)
1. What is the main difference between Markdown and MDX in Astro?
easy
A. Markdown supports JavaScript code, but MDX does not.
B. Markdown files can run server code, MDX files cannot.
C. MDX is only for styling, Markdown is for content.
D. MDX allows embedding components inside Markdown content, while Markdown does not.
Solution
Step 1: Understand Markdown basics
Markdown is a simple way to write formatted text like headings, lists, and links.
Step 2: Understand MDX extension
MDX extends Markdown by allowing you to include interactive components inside the text.
Final Answer:
MDX allows embedding components inside Markdown content, while Markdown does not. -> Option D
Quick Check:
MDX = Markdown + components [OK]
Hint: Remember: MDX = Markdown + components [OK]
Common Mistakes:
Thinking Markdown supports components
Confusing MDX with styling only
Believing Markdown runs server code
2. Which file extension should you use for a page that includes React components inside Markdown in Astro?
easy
A. .mdx
B. .astro
C. .md
D. .jsx
Solution
Step 1: Identify file types for Markdown and MDX
Markdown files use .md extension, MDX files use .mdx extension to support components.
Step 2: Match file extension to React components inside Markdown
To include React components inside Markdown, use .mdx files.
Final Answer:
.mdx -> Option A
Quick Check:
React components in Markdown = .mdx [OK]
Hint: Use .mdx for Markdown with components [OK]
Common Mistakes:
Using .md for MDX content
Confusing .astro with Markdown files
Choosing .jsx which is for pure React files
3. Given this Astro MDX page snippet, what will be rendered?
---
import Button from '../components/Button.jsx';
---
# Welcome
Click me
medium
A. A syntax error because components can't be imported in MDX.
B. Only the heading 'Welcome' without the button.
C. A heading 'Welcome' and a clickable button labeled 'Click me'.
D. The button renders but the heading does not.
Solution
Step 1: Understand MDX import and usage
MDX allows importing components at the top and using them inline in the Markdown content.
Step 2: Analyze the snippet output
The heading '# Welcome' renders as a heading, and the <Button> component renders as a clickable button with text 'Click me'.
Final Answer:
A heading 'Welcome' and a clickable button labeled 'Click me'. -> Option C
Quick Check:
MDX imports + components = rendered output [OK]
Hint: MDX imports components, renders both text and UI [OK]
Common Mistakes:
Thinking imports cause syntax errors in MDX
Assuming components won't render inside MDX
Ignoring Markdown headings when components are present
4. What is wrong with this Astro MDX page snippet?
---
import Alert from '../components/Alert.jsx'
---
# Notice
This is important
medium
A. No error; this code is correct.
B. Incorrect import path syntax.
C. Missing semicolon after import statement.
D. Missing closing quote in import statement.
Solution
Step 1: Check import syntax in MDX frontmatter
In MDX frontmatter, semicolons are optional and import paths use quotes correctly.
Step 2: Verify component usage
The Alert component is imported and used correctly inside the MDX content.
Final Answer:
No error; this code is correct. -> Option A
Quick Check:
MDX import syntax is flexible = correct [OK]
Hint: Semicolons optional in MDX imports [OK]
Common Mistakes:
Expecting semicolons after imports
Thinking import paths need special syntax
Assuming missing semicolon causes error
5. You want to create a blog post in Astro that uses Markdown for text and includes a custom interactive component for comments. Which approach is best?
hard
A. Write the entire post in .md and import the component inside it.
B. Use .mdx for the post so you can embed the comment component directly.
C. Create a .astro page and write Markdown inside it manually.
D. Use .md and add the component via client-side JavaScript after page load.
Solution
Step 1: Understand Markdown limitations
Plain .md files cannot embed components directly; they are static content.
Step 2: Consider MDX advantages
.mdx files allow mixing Markdown with components, perfect for interactive elements like comments.
Step 3: Evaluate other options
.astro pages can include Markdown but require more setup; client-side JS injection is less clean and less integrated.
Final Answer:
Use .mdx for the post so you can embed the comment component directly. -> Option B
Quick Check:
Interactive + Markdown = MDX [OK]
Hint: Embed components directly by using .mdx files [OK]
Common Mistakes:
Trying to import components in plain .md files
Ignoring MDX for interactive content
Overcomplicating with client-side JS injection
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.