All types are exported from the main entry point for TypeScript support.
import type {
// Core types
BaseFrontmatter,
DocsConfig,
RemoteDocsConfig,
ParseResult,
SerializeResult,
DocsInstance,
ParseSlugOptions,
LocalOptions,
RemoteOptions,
// Navigation types
NavItem,
MetaItem,
// Plugin types
RemarkPlugins,
RehypePlugins,
// Component types
MdxServerProps,
MdxClientProps,
// Re-exports from external libs
MDXComponents,
TocItem,
} from "@ariadocs/react";
BaseFrontmatterDefault frontmatter structure for MDX files.
interface BaseFrontmatter {
title?: string;
description?: string;
}
DocsConfigConfiguration for local docs operations.
interface DocsConfig {
/** Path to the content directory */
contentDir: string;
/** Remark plugins for MDX processing */
remarkPlugins?: RemarkPlugins;
/** Rehype plugins for MDX processing */
rehypePlugins?: RehypePlugins;
/** Custom MDX components */
mdxComponents?: MDXComponents;
}
RemoteDocsConfigConfiguration for remote MDX operations.
interface RemoteDocsConfig {
/** Raw MDX content string */
raw: string;
/** Remark plugins for MDX processing */
remarkPlugins?: RemarkPlugins;
/** Rehype plugins for MDX processing */
rehypePlugins?: RehypePlugins;
/** Custom MDX components */
mdxComponents?: MDXComponents;
}
ParseResult<T>Result from parseMdx and parseMdxRemote.
interface ParseResult<T = BaseFrontmatter> {
/** Raw MDX content */
raw: string;
/** MDX content without frontmatter */
content: string;
/** Parsed frontmatter */
frontmatter: T;
/** Table of contents */
toc: TocItem[];
/** Rendered MDX component */
MDX: ReactNode;
}
SerializeResult<T>Result from serializeMdx and serializeMdxRemote.
interface SerializeResult<T = BaseFrontmatter> {
/** Serialized MDX for client */
serialized: string;
/** Parsed frontmatter */
frontmatter: T;
/** Table of contents */
toc: TocItem[];
}
DocsInstance<T>Instance returned by createDocs.
interface DocsInstance<T = BaseFrontmatter> {
/** Parse MDX for server-side rendering */
parse: (options: ParseSlugOptions) => Promise<ParseResult<T>>;
/** Serialize MDX for client-side rendering */
serialize: (options: ParseSlugOptions) => Promise<SerializeResult<T>>;
/** Get frontmatter only */
getFrontmatter: (options: ParseSlugOptions) => Promise<T>;
/** Get table of contents only */
getToc: (options: ParseSlugOptions) => Promise<TocItem[]>;
/** Read raw MDX content */
readMdx: (options: ParseSlugOptions) => Promise<string>;
/** Get navigation items */
getNavItems: () => Promise<NavItem[]>;
/** Get all page paths */
getPagePaths: () => Promise<string[]>;
/** Readonly access to config */
config: Readonly<DocsConfig>;
}
NavItemNavigation item structure.
interface NavItem {
/** Display title */
title: string;
/** URL path */
href: string;
/** File/folder slug */
slug: string;
/** Whether to show in navigation */
nav: boolean;
/** Nested child items */
items: NavItem[];
/** Custom properties from _meta.json */
props: Record<string, string>;
}
MetaItemStructure for _meta.json items.
interface MetaItem {
/** File/folder slug (without extension) */
slug: string;
/** Display title (optional, defaults to slugToTitle) */
title?: string;
/** Whether to show in navigation */
nav?: boolean;
/** Custom properties for rendering */
props?: Record<string, string>;
}
RemarkPluginsType for remark plugin arrays.
type RemarkPlugins = PluggableList;
RehypePluginsType for rehype plugin arrays.
type RehypePlugins = PluggableList;
MdxServerPropsProps for MdxServer component.
interface MdxServerProps {
/** Raw MDX content string */
raw: string;
/** Plugin configuration */
options?: DocsConfig;
/** Custom MDX components */
components?: MDXComponents;
}
MdxClientPropsProps for MdxClient component.
interface MdxClientProps {
/** Serialized MDX from serializeMdx */
serialized: string;
/** Custom MDX components */
mdxComponents?: MDXComponents;
}
ParseSlugOptionsOptions for parsing with slug.
interface ParseSlugOptions {
/** File path without .mdx extension */
slug: string;
/** Override remark plugins */
remarkPlugins?: RemarkPlugins;
/** Override rehype plugins */
rehypePlugins?: RehypePlugins;
/** Override MDX components */
mdxComponents?: MDXComponents;
}
LocalOptionsOptions for local file operations.
interface LocalOptions {
/** Path to content directory */
contentDir: string;
/** File path without .mdx extension */
slug: string;
}
RemoteOptionsOptions for remote content operations.
interface RemoteOptions {
/** Raw MDX content string */
raw: string;
}
Types re-exported from external libraries:
MDXComponentsFrom mdx/types. Used for providing custom components to MDX.
type MDXComponents = Record<string, React.ComponentType<any>>;
TocItemTable of contents item structure.
interface TocItem {
/** Heading ID */
id: string;
/** Heading text */
value: string;
/** Heading depth (1-6) */
depth: number;
/** Nested items */
items?: TocItem[];
}
Types can also be imported from dedicated sub-paths:
| Export | Description |
|---|---|
@ariadocs/react | All types |
@ariadocs/react/types | Types only (tree-shaken) |
interface RemoteOptions {
/** Raw MDX content string */
raw: string;
}
Types re-exported from external libraries:
MDXComponentsFrom mdx/types. Used for providing custom components to MDX.
type MDXComponents = Record<string, React.ComponentType<any>>;
TocItemTable of contents item structure.
interface TocItem {
/** Heading ID */
id: string;
/** Heading text */
value: string;
/** Heading depth (1-6) */
depth: number;
/** Nested items */
items?: TocItem[];
}
Types can also be imported from dedicated sub-paths:
| Export | Description |
|---|---|
@ariadocs/react | All types |
@ariadocs/react/types | Types only (tree-shaken) |