Skip to main content

Crate dioxus_docs_kit

Crate dioxus_docs_kit 

Source
Expand description

§dioxus-docs-kit

Reusable documentation site shell and blog engine for Dioxus applications.

Provides a complete docs layout with sidebar navigation, search modal, page navigation, OpenAPI API reference pages, and mobile drawer. Also includes a full blog engine with post listing, tag filtering, search, reading time, and MDX rendering.

§Quick Start — Docs

use dioxus::prelude::*;
use dioxus_docs_kit::{DocsConfig, DocsRegistry, DocsContext, DocsLayout, DocsPageContent};
use std::sync::LazyLock;

static DOCS: LazyLock<DocsRegistry> = LazyLock::new(|| {
    DocsConfig::new(include_str!("../docs/_nav.json"), doc_content_map())
        .with_default_path("getting-started/introduction")
        .build()
});

§Quick Start — Blog

use dioxus::prelude::*;
use dioxus_docs_kit::{BlogConfig, BlogRegistry, BlogContext, BlogLayout, BlogList, BlogPostView};
use std::sync::LazyLock;

dioxus_docs_kit::blog_content_map!();

static BLOG: LazyLock<BlogRegistry> = LazyLock::new(|| {
    BlogConfig::new(include_str!("../blog/_blog.json"), blog_content_map())
        .with_posts_per_page(9)
        .build()
});

Re-exports§

pub use config::CodeThemeConfig;
pub use config::DocsConfig;
pub use config::ThemeConfig;
pub use error::DocsKitError;
pub use registry::DocsRegistry;
pub use registry::ApiEndpointEntry;
pub use registry::NavConfig;
pub use registry::NavGroup;
pub use registry::SearchEntry;
pub use components::ActiveTab;
pub use components::CopyPageButton;
pub use components::CopyPageButton;
pub use components::CurrentTheme;
pub use components::DocsLayout;
pub use components::DocsLayout;
pub use components::DocsPageContent;
pub use components::DocsPageContent;
pub use components::DocsPageMeta;
pub use components::DocsPageMeta;
pub use components::DocsPageNav;
pub use components::DocsPageNav;
pub use components::DocsSidebar;
pub use components::DocsSidebar;
pub use components::DocsVariant;
pub use components::DrawerOpen;
pub use components::LayoutOffsets;
pub use components::MobileDrawer;
pub use components::MobileDrawer;
pub use components::SearchButton;
pub use components::SearchButton;
pub use components::SearchModal;
pub use components::SearchModal;
pub use components::SearchOpen;
pub use components::ThemeToggle;
pub use components::ThemeToggle;
pub use components::use_theme_provider;
pub use hooks::DocsProviders;
pub use hooks::use_docs_context;
pub use hooks::use_docs_providers;
pub use blog::hooks::ActiveTag;
pub use blog::hooks::CurrentPage;
pub use blog::types::Author;
pub use blog::types::BlogFrontmatter;
pub use blog::types::BlogPost;
pub use blog::types::BlogSearchEntry;
pub use blog::BlogConfig;
pub use blog::BlogProviders;
pub use blog::BlogRegistry;
pub use blog::use_blog_providers;
pub use components::AuthorInfo;
pub use components::AuthorInfo;
pub use components::BlogCard;
pub use components::BlogCard;
pub use components::BlogIndexMeta;
pub use components::BlogIndexMeta;
pub use components::BlogLayout;
pub use components::BlogLayout;
pub use components::BlogList;
pub use components::BlogList;
pub use components::BlogMobileDrawer;
pub use components::BlogMobileDrawer;
pub use components::BlogPostMeta;
pub use components::BlogPostMeta;
pub use components::BlogPostNav;
pub use components::BlogPostNav;
pub use components::BlogPostView;
pub use components::BlogPostView;
pub use components::BlogSearchButton;
pub use components::BlogSearchButton;
pub use components::BlogSearchModal;
pub use components::BlogSearchModal;
pub use components::BlogThemeToggle;
pub use components::BlogThemeToggle;
pub use components::ReadingProgressBar;
pub use components::ReadingProgressBar;
pub use components::ReadingTimeBadge;
pub use components::ReadingTimeBadge;
pub use components::RelatedPosts;
pub use components::RelatedPosts;
pub use components::TagFilter;
pub use components::TagFilter;

Modules§

blog
Blog engine module for dioxus-docs-kit.
components
config
Builder for constructing a DocsRegistry.
error
Error types for registry construction.
hooks
registry
Documentation content registry.
server
Server-side (Axum) routes for crawler-facing endpoints.

Macros§

blog_content_map
Generates a blog_content_map() function that returns a HashMap<&'static str, &'static str> from the build-script output.
doc_content_map
Generates a doc_content_map() function that returns a HashMap<&'static str, &'static str> from the build-script output.

Structs§

ApiOperation
API endpoint operation.
ApiTag
Tag metadata.
BlogContext
Navigation bridge for blog pages, decoupled from the consumer’s Route enum.
CodeTheme
Syntax theme selection for Code().
CodeThemeOverride
Reactive override for the syntax-highlighting theme used by rendered code blocks.
DocsContext
Navigation bridge that decouples library components from the consumer’s Route enum.
OpenApiSpec
Parsed OpenAPI specification.
ParsedDoc
Parsed documentation page with frontmatter and content.
SourceCode
Source text to highlight at runtime.
Theme
A syntax-highlighting theme.

Enums§

HttpMethod
HTTP method.
Language
Tree-sitter grammar identifier.

Constants§

DOCS_KIT_CSS
Precompiled stylesheet covering every class the kit’s components emit (Tailwind utilities, DaisyUI dark/light themes, typography prose, and the --dk-* token surface from theme.css).

Functions§

Code
Render syntax-highlighted source code.
DocContent
Render a list of DocNodes.
DocTableOfContents
Table of contents sidebar component with scroll tracking.
EndpointPage
Full-page two-column layout for a single API endpoint.
MermaidDiagram
Renders a mermaid diagram.
extract_headers
Extract headers from markdown content for table of contents.