This post demonstrates the enhanced MDX capabilities now available on our blog.
Syntax Highlighting
You can use inline code like this: const hello = "world";
Also, you can use regular code blocks:
function greet(name) {
console.log(`Hello, ${name}!`)
// This is a multi-line code example
// to demonstrate syntax highlighting
return {
message: `Hello, ${name}!`,
timestamp: new Date(),
}
}
// Call the function
greet('World')
Custom Components
Callouts
This is a default info callout.
Success
Your changes have been saved successfully!
Warning
This action cannot be undone. Proceed with caution.
Error
Something went wrong. Please try again later.
Code Blocks
Code blocks now have syntax highlighting:
function greet(name) {
console.log(`Hello, ${name}!`)
// This is a multi-line code example
// to demonstrate syntax highlighting
return {
message: `Hello, ${name}!`,
timestamp: new Date(),
}
}
// Call the function
greet('World')
You can also use the CodeBlock component directly, with a filename in this example:
example.ts
const heading = "Custom Code Block";
console.log(heading);
Regular Markdown Features
All standard Markdown features work as expected:
Lists
- Item 1
- Item 2
- Nested item A
- Nested item B
- Item 3
Blockquotes
This is a blockquote with formatting inside.
Links
External link and internal link
Tables
Feature | Description |
---|---|
Callouts | Highlighted information boxes |
Code Blocks | Syntax highlighting |
Automatic Links | External links open in new tabs |
Month | Savings |
---|---|
January | $250 |
February | $80 |
March | $420 |
Conclusion
With these enhanced MDX features, we can create more interactive and visually appealing blog posts.