Advanced Markdown Features Demo
This post demonstrates the advanced markdown features available in the Duct Starter Template using our custom markdown parser with essential plugins.
Syntax Highlighting π
Code blocks with syntax highlighting powered by Prism.js:
interface User {
id: string
name: string
email: string
}
function createUser(data: Partial<User>): User {
return {
id: crypto.randomUUID(),
...data
} as User
}
const user = createUser({
name: "John Doe",
email: "john@example.com"
})
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build for production
pnpm build
Custom Containers π
Information Callout π
Quick Tip
You can use custom containers to highlight important information in your blog posts!
Warning Callout π
Be Careful
This is a warning callout to draw attention to important notes or potential issues.
Success Callout π
Well Done
Great job! Youβve successfully implemented the advanced markdown features.
Error Callout π
Error
Something went wrong. Check your configuration and try again.
Header Anchors π
All headers automatically get anchor links for easy sharing. Hover over any header to see the permalink icon.
This Header Has An Anchor π
You can also create custom anchors using the attrs plugin.
Footnotes π
Hereβs some text with a footnote[1].
You can also use named footnotes[2].
Attributes Plugin π
Add CSS classes and attributes to elements:
- This list item has a custom class
- This one has an ID
- And this one has multiple attributes
Styled Elements π
Create a button-like link: Click Me
Or add custom styling: This text is bold and red
Typography π
The typographer option enables smart quotes, dashes, and other typography enhancements:
- βSmart quotesβ become curly
- Β© becomes Β©
- β’ becomes β’
- β becomes β
- β becomes β
- β¦ becomes β¦
External Links π
External links automatically get target="_blank"
and security attributes:
- Duct UI Documentation - External link
- Internal Link - Internal link (no target blank)
Code Features π
Inline code with highlighting: const message = "Hello World"
Code with line numbers and highlighting:
function fibonacci(n) {
if (n <= 1) return n
return fibonacci(n - 1) + fibonacci(n - 2)
}
console.log(fibonacci(10)) // 55
Advanced Lists π
- Numbered lists work great
- With formatting and
code
- And they can be nested:
- Sub item one
- Sub item two
- Sub item three
Task lists:
Tables π
Feature | Status | Notes |
---|---|---|
Syntax Highlighting | β | Prism.js integration |
Custom Containers | β | Info, warning, success, error |
Header Anchors | β | Auto-generated permalinks |
Footnotes | β | Numbered and named |
Attributes | β | Classes, IDs, and more |
Conclusion π
This custom markdown parser provides a rich set of features for creating engaging blog content:
- Enhanced Code Blocks - Syntax highlighting for many languages
- Visual Callouts - Custom containers for different types of information
- Better Navigation - Automatic header anchors
- Rich Typography - Smart quotes and special characters
- Flexible Styling - Attribute support for custom CSS classes
- External Link Security - Automatic
target="_blank"
for external links
With these features, you can create professional, interactive blog posts that engage your readers and provide excellent user experience.
Happy writing! π