test02/node_modules/@mdit-vue/plugin-frontmatter/dist/index.d.ts
罗佳鸿 6aa1ebe342
Some checks are pending
部署文档 / deploy-gh-pages (push) Waiting to run
first commit
2024-08-13 10:11:19 +08:00

50 lines
1.3 KiB
TypeScript

import { PluginWithOptions } from 'markdown-it';
import matter from 'gray-matter';
type GrayMatterOptions = matter.GrayMatterOption<string, GrayMatterOptions>;
/**
* Options of @mdit-vue/plugin-frontmatter
*/
interface FrontmatterPluginOptions {
/**
* Options of gray-matter
*
* @see https://github.com/jonschlinkert/gray-matter#options
*/
grayMatterOptions?: GrayMatterOptions;
/**
* Render the excerpt or not
*
* @default true
*/
renderExcerpt?: boolean;
}
declare module '@mdit-vue/types' {
interface MarkdownItEnv {
/**
* The raw Markdown content without frontmatter
*/
content?: string;
/**
* The excerpt that extracted by `@mdit-vue/plugin-frontmatter`
*
* - Would be the rendered HTML when `renderExcerpt` is enabled
* - Would be the raw Markdown when `renderExcerpt` is disabled
*/
excerpt?: string;
/**
* The frontmatter that extracted by `@mdit-vue/plugin-frontmatter`
*/
frontmatter?: Record<string, unknown>;
}
}
/**
* Get markdown frontmatter and excerpt
*
* Extract them into env
*/
declare const frontmatterPlugin: PluginWithOptions<FrontmatterPluginOptions>;
export { type FrontmatterPluginOptions, frontmatterPlugin };