Definition
Assembly: Mintlify.Core.dll Namespace: Mintlify.Core Inheritance: System.ObjectSyntax
Summary
Loads and manages Mintlify docs.json configuration files with navigation manipulation capabilities.Remarks
This class provides comprehensive support for loading, validating, and modifying Mintlify documentation configuration files. It handles serialization using the standard Mintlify JSON options and provides APIs for navigation manipulation.Constructors
.ctor
Initializes a new instance of the DocsJsonManager class.Syntax
Parameters
.ctor
Initializes a new instance of the DocsJsonManager class with the specified file path.Syntax
Parameters
Exceptions
.ctor Inherited
Inherited from
objectSyntax
Properties
Configuration
Gets the loaded Mintlify documentation configuration.Syntax
Property Value
Type:Mintlify.Core.Models.DocsJsonConfig?
The DocsJsonConfig instance loaded from the file system or string content.
Returns null if no configuration has been loaded or if loading failed.
ConfigurationErrors
Gets the collection of configuration loading errors encountered during processing.Syntax
Property Value
Type:System.Collections.Generic.List<System.CodeDom.Compiler.CompilerError>
A collection of CompilerError instances representing validation errors,
parsing failures, or other issues encountered during configuration loading.
FilePath
Gets the file path of the loaded docs.json configuration file.Syntax
Property Value
Type:string?
The full path to the docs.json file that was loaded. Returns null if the configuration
was loaded from string content rather than a file.
IsLoaded
Gets a value indicating whether the configuration has been successfully loaded.Syntax
Property Value
Type:bool
True if the configuration was loaded without errors; otherwise, false.
Methods
AddNavigationItem
Adds a navigation item (page or group) to the specified collection, tracking paths appropriately.Syntax
Parameters
Returns
Type:bool
True if the item was added; false if it was skipped (duplicate).
AddPage
Adds a page to the navigation structure if it doesn’t already exist.Syntax
Parameters
Returns
Type:bool
True if the page was added; false if it already existed and duplicates are not allowed.
AddPage
Adds a page to a hierarchical group path (slash-separated) in the navigation structure.Syntax
Parameters
Returns
Type:bool
True if the page was added; false if it already existed and duplicates are not allowed.
Exceptions
AddPageToGroup
Adds a page to a group if it doesn’t already exist.Syntax
Parameters
Returns
Type:bool
True if the page was added; false if it already existed and duplicates are not allowed.
ApplyDefaults
Applies default values to missing configuration properties.Syntax
Parameters
Exceptions
ApplyUrlPrefix
Applies a URL prefix to all page references in the navigation structure.Syntax
Parameters
Exceptions
Remarks
This method recursively traverses the entire navigation structure and prepends the specified prefix to all page URLs, href attributes, and root paths. The prefix is normalized to ensure proper URL formatting (e.g., trailing slashes are handled).CreateDefault
Creates a default Mintlify documentation configuration with basic structure.Syntax
Parameters
Returns
Type:Mintlify.Core.Models.DocsJsonConfig
A new DocsJsonConfig instance with default values.
Exceptions
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
FindOrCreateGroup
Finds or creates a group with the specified name in the pages collection.Syntax
Parameters
Returns
Type:Mintlify.Core.Models.GroupConfig
The existing or newly created group.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
IsPathKnown
Checks if a page path is already known (tracked for duplicate prevention).Syntax
Parameters
Returns
Type:bool
True if the path is already known; otherwise, false.
Load
Loads and parses the docs.json file from the file path specified in the constructor.Syntax
Exceptions
Load
Loads and parses the docs.json configuration from the specified string content.Syntax
Parameters
Exceptions
Load
Loads the specified configuration and applies validation and cleaning steps.Syntax
Parameters
Remarks
This method replaces any existing configuration and clears previous configuration errors. After loading, the configuration is validated and navigation groups are cleaned to ensure consistency.MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
Merge
Merges another docs.json configuration into the current configuration.Syntax
Parameters
Exceptions
Remarks
This method performs a shallow merge, with the other configuration taking precedence for non-null values. Navigation structures are combined intelligently.MergeNavigation
Merges navigation from another NavigationConfig into the current configuration’s navigation.Syntax
Parameters
Exceptions
Remarks
This method intelligently merges navigation structures, combining groups with the same name and deduplicating page references. Use the MergeOptions parameter to control specific behaviors like how empty groups are handled.MergeNavigation
Merges navigation from an existing docs.json file into the current configuration.Syntax
Parameters
Exceptions
Remarks
This method loads navigation from an external docs.json file and merges it into the current configuration. Only the navigation structure is merged; other configuration properties are not affected.PopulateNavigationFromPath
Populates the navigation structure from a directory path by scanning for MDX files.Syntax
Parameters
Exceptions
Remarks
This method scans the specified directory recursively and builds a navigation structure based on the folder hierarchy and MDX files found. The method includes several advanced features: The method preserves the directory structure in the navigation while applying these intelligent processing rules to create clean, organized documentation.ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
Save
Saves the current configuration to the file system using the original file path.Syntax
Exceptions
Save
Saves the current configuration to the specified file path.Syntax
Parameters
Exceptions
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?