Skip to main content
Mintlify.Core is a comprehensive .NET library that provides strongly-typed models, validation, and management tools for Mintlify documentation configurations. Built by the CloudNimble team and used by DotNetDocs, it enables C# developers to programmatically generate, modify, and validate docs.json files with full IntelliSense support.

Why Use Mintlify.Core?

Type Safety

Strongly-typed C# models for every Mintlify configuration option with compile-time validation

IntelliSense Support

Full XML documentation on every property with examples and schema references

Validation Built-In

Comprehensive validation against Mintlify schema ensures configurations will work before deployment

Multi-Platform

Targets .NET Standard 2.0, .NET 8, .NET 9, and .NET 10 for maximum compatibility

Navigation Management

Advanced DocsJsonManager for intelligent navigation merging and duplicate detection

Production Ready

Battle-tested in DotNetDocs and used by Sustainment for managing complex documentation sites

Installation

Install via NuGet Package Manager or .NET CLI:

Quick Start

Create a basic Mintlify configuration programmatically:

Core Components

DocsJsonConfig

The root configuration object representing the complete docs.json schema:
All required properties are marked with [NotNull] and will generate compiler warnings if not set. Use the DocsJsonValidator to catch configuration issues at runtime.
Defines the documentation structure with support for pages, groups, tabs, anchors, and more:
Pages Property: The Pages property is polymorphic - it can contain both string (page paths) and GroupConfig objects (nested groups):

GroupConfig

Organizes pages into collapsible sections:
Nested Groups: Groups can contain other groups for hierarchical navigation:

ColorsConfig

Theme color configuration with hex color validation:
All colors must be valid hex format: #RRGGBB or #RGB. The validator will catch invalid formats.

DocsJsonManager

The DocsJsonManager class provides advanced navigation management with intelligent merging and duplicate detection:

Key Features

Load & Save
Create Default Configuration
Navigation Discovery
Smart Navigation Merging
Add Pages Safely
Check Known Paths

Duplicate Detection

The DocsJsonManager maintains an internal _knownPagePaths HashSet that tracks every page path added to navigation:
Duplicate detection is case-insensitive and works across all navigation levels (root pages, grouped pages, nested groups).

DocsJsonValidator

Comprehensive validation against the Mintlify schema:

Validation Rules

The validator checks: Required Fields
  • Name must be set
  • Theme must be set and valid
  • Colors.Primary must be a valid hex color
  • Navigation must have at least one navigation element
Theme Validation
  • Must be one of: mint, maple, palm, willow, linden, almond, aspen
Color Validation
  • All colors must match regex: ^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
  • Examples: #FF0000, #F00, #419AC5
Navigation Validation
  • Must contain at least one of: pages, groups, anchors, tabs, dropdowns, languages, versions
  • Group names cannot be null (Mintlify will reject the config)
  • Empty group names generate warnings (treated as separate ungrouped sections)
API Configuration Validation
  • Auth methods: bearer, basic, key, cobo
  • Playground display: interactive, simple, none
  • Examples defaults: all, required
Appearance Validation
  • Default mode: system, light, dark
Icons Validation
  • Library: fontawesome, lucide
SEO Validation
  • Indexing: navigable, all

Example Validation Output

MintlifyConstants

Provides shared configuration for consistent JSON serialization:
The JsonSerializerOptions instance includes:
  • Indented formatting for readable JSON output
  • CamelCase property naming to match Mintlify schema
  • Null value ignoring to omit optional properties
  • Custom converters for polymorphic types:
    • NavigationJsonConverter - Handles complex navigation structures
    • NavigationPageListConverter - Handles mixed string/GroupConfig lists
    • IconConverter - Supports both string and object icon formats
    • ColorConverter - Handles color pairs and single values
    • ApiConfigConverter - Handles API spec configuration formats

Usage

Configuration Models Reference

Mintlify.Core includes 50+ strongly-typed models covering every Mintlify configuration option:

Theme & Appearance

Theme color configurationProperties:
  • Primary (required): Main theme color
  • Light: Light mode accent
  • Dark: Dark mode accent
Logo configuration for light and dark modesProperties:
  • Light: Path to light mode logo
  • Dark: Path to dark mode logo
  • Href: URL logo links to
Favicon paths for different modesProperties:
  • Light: Light mode favicon
  • Dark: Dark mode favicon
Appearance and color mode settingsProperties:
  • Default: Default mode (system, light, dark)
  • Toggle: Show dark mode toggle
Custom styling and CSSProperties:
  • StylesheetPaths: Array of custom CSS file paths
  • Codeblocks: Code block styling options
Top-level navigation tabsProperties:
  • Tab: Tab title
  • Href: Tab URL
  • Pages: Tab pages
  • Groups: Tab groups
  • Icon: Tab icon
Sidebar anchor linksProperties:
  • Anchor: Link text
  • Href: Link URL
  • Icon: Anchor icon

API & Integration

API playground and documentation settingsProperties:
  • Mdx: MDX API configuration
  • Playground: Playground display settings
  • Examples: Example configuration
  • Params: Parameter settings
Analytics and third-party integrationsProperties:
  • GoogleAnalytics: GA tracking ID
  • GoogleTagManager: GTM ID
  • Mixpanel: Mixpanel project token
  • Segment: Segment write key
  • Intercom: Intercom app ID
  • And 10+ more integrations
SEO and indexing settingsProperties:
  • Indexing: Indexing mode (navigable, all)
  • Sitemap: Custom sitemap URL

Advanced Features

Footer configuration with social linksProperties:
  • Socials: Social media links
  • Links: Custom footer links
Top banner configurationProperties:
  • Text: Banner text
  • Link: Banner link URL
  • Color: Banner color
URL redirectsProperties:
  • Source: Source path
  • Destination: Destination path
Search configurationProperties:
  • Provider: Search provider
  • AlgoliaConfig: Algolia settings

Advanced Scenarios

Building Multi-Project Documentation

Custom Navigation Override

Programmatic Theme Configuration

Validation Pipeline

Best Practices

Always Validate

Use DocsJsonValidator before saving configurations to catch errors early. Invalid configs will be rejected by Mintlify.

Use DocsJsonManager

Leverage DocsJsonManager for navigation operations instead of manually manipulating collections. It handles duplicate detection automatically.

Preserve Templates

When using PopulateNavigationFromPath, set preserveExisting: true to merge discovered content with template navigation.

Check Known Paths

Use IsPathKnown() before adding pages to avoid duplicates. The manager tracks all paths internally.

Serialize with Constants

Always use MintlifyConstants.JsonSerializerOptions for consistent JSON formatting and proper converter handling.

Set Required Fields First

Initialize Name, Theme, Colors.Primary, and Navigation before other properties. These are required by Mintlify.

Multi-Platform Support

Mintlify.Core targets multiple .NET platforms for maximum compatibility: All core functionality works identically across platforms, with some optimizations for modern frameworks (e.g., source-generated regex in .NET 7+).

See Also

Navigation Generation

Learn how MintlifyRenderer uses DocsJsonManager to build navigation

Mintlify Provider Overview

Complete guide to the Mintlify provider features

DocsJsonManager API

Full API reference for DocsJsonManager class

Mintlify Schema

Official Mintlify docs.json schema reference