Advanced Markdown Features Demo

By Duct UI Team

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 automatically get target="_blank" and security attributes:

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 πŸ”—

  1. Numbered lists work great
  2. With formatting and code
  3. 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:

  1. Enhanced Code Blocks - Syntax highlighting for many languages
  2. Visual Callouts - Custom containers for different types of information
  3. Better Navigation - Automatic header anchors
  4. Rich Typography - Smart quotes and special characters
  5. Flexible Styling - Attribute support for custom CSS classes
  6. 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! πŸš€


  1. This is the first footnote. β†©οΈŽ

  2. This is a named footnote with more detailed information. β†©οΈŽ