content library

Content support for Duxt framework

Provides markdown content loading, parsing, and rendering capabilities for building documentation sites and content-driven applications.

Features

  • Frontmatter parsing (title, description, etc.)
  • Markdown to HTML conversion
  • Table of contents generation
  • Navigation structure building
  • Documentation layouts
  • Custom component embedding in markdown
  • jaspr_content integration

Usage

import 'package:duxt/content.dart';

// In main.server.dart
runApp(
  Document(
    body: DuxtContentApp(
      layouts: [DocsLayout(), UiLayout()],
      components: [CodeBlock(), Callout(), Image(zoom: true)],
      theme: ContentTheme(
        primary: ThemeColor(ThemeColors.cyan.$500),
      ),
    ),
  ),
);

Using ContentLoader (Manual)

import 'package:duxt/content.dart';

final loader = ContentLoader(
  config: ContentLoaderConfig(
    contentDir: 'content',
    includeDrafts: false,
  ),
);

final doc = await loader.load('getting-started/index');
final docs = await loader.loadDirectory('components');
final nav = await loader.loadNavigation();

Classes

Callout
A custom callout component.
CodeBlock
A code block component that renders syntax-highlighted code.
ContentApp
The root component for building a content-driven site.
ContentCallout
Callout/alert component for documentation
ContentCodeBlock
Code block component with syntax highlighting support
ContentDocument
Represents parsed content with frontmatter and body
ContentLoader
Content loader for loading and parsing markdown files
ContentLoaderConfig
Content loader configuration
ContentNav
Navigation sidebar component for content sections
ContentPage
Component for rendering a content document
ContentRouteInfo
Route information for content pages (used at runtime)
ContentTheme
A theme for content-driven sites.
ContentToc
Table of contents component
CustomComponent
CustomComponentBase
Base class for creating components based on a name pattern.
DocsContentLayout
Documentation layout component with sidebar, content, and TOC
DuxtContentApp
Duxt-flavored ContentApp for documentation sites
DuxtContentPage
Renders markdown content pages with the unified layout system
DuxtPageConfig
Configuration for DuxtPage rendering
DuxtPageLayout
Base class for Duxt documentation layouts
HeadingAnchorsExtension
An extension that generates anchor links for headers in the page.
Image
An image component with optional zooming and caption support.
MarkdownContent
Markdown content renderer component
MarkdownParser
A parser for Markdown content.
MustacheTemplateEngine
A template engine that uses the Mustache templating language.
Navigation item
Navigation section for sidebar
Page
A single page of the site.
PageExtension
An extension that can post-process a page and its parsed nodes.
PageLayoutBase
A base implementation of a page layout.
PageParser
Parses a page into a list of nodes.
TableOfContentsExtension
An extension that generates a table of contents from the headers in the page.
TemplateEngine
A template engine for preprocessing a page's content.
ThemeColor
A color that holds a variant for light and dark themes.
ThemeColors
A vast and beautiful color theme.
TocEntry
Table of contents entry