mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 00:32:47 +02:00
feat(content-pages): front matter validation, include front matter in metadata (#6400)
This commit is contained in:
parent
e5801e49f6
commit
fdf59f30f0
7 changed files with 103 additions and 37 deletions
|
@ -19,22 +19,45 @@ declare module '@docusaurus/plugin-content-pages' {
|
|||
};
|
||||
|
||||
export type Options = Partial<PluginOptions>;
|
||||
|
||||
export type FrontMatter = {
|
||||
readonly title?: string;
|
||||
readonly description?: string;
|
||||
readonly wrapperClassName?: string;
|
||||
readonly hide_table_of_contents?: string;
|
||||
readonly toc_min_heading_level?: number;
|
||||
readonly toc_max_heading_level?: number;
|
||||
};
|
||||
|
||||
export type JSXPageMetadata = {
|
||||
type: 'jsx';
|
||||
permalink: string;
|
||||
source: string;
|
||||
};
|
||||
|
||||
export type MDXPageMetadata = {
|
||||
type: 'mdx';
|
||||
permalink: string;
|
||||
source: string;
|
||||
frontMatter: FrontMatter & Record<string, unknown>;
|
||||
title?: string;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
export type Metadata = JSXPageMetadata | MDXPageMetadata;
|
||||
}
|
||||
|
||||
declare module '@theme/MDXPage' {
|
||||
import type {TOCItem} from '@docusaurus/types';
|
||||
import type {
|
||||
MDXPageMetadata,
|
||||
FrontMatter,
|
||||
} from '@docusaurus/plugin-content-pages';
|
||||
|
||||
export interface Props {
|
||||
readonly content: {
|
||||
readonly frontMatter: {
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
readonly wrapperClassName?: string;
|
||||
readonly hide_table_of_contents?: string;
|
||||
readonly toc_min_heading_level?: number;
|
||||
readonly toc_max_heading_level?: number;
|
||||
};
|
||||
readonly metadata: {readonly permalink: string};
|
||||
readonly frontMatter: FrontMatter;
|
||||
readonly metadata: MDXPageMetadata;
|
||||
readonly toc: readonly TOCItem[];
|
||||
(): JSX.Element;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue