0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/markdoc/src/config.ts
2023-06-06 18:51:14 +00:00

32 lines
884 B
TypeScript

import type {
Config,
ConfigType as MarkdocConfig,
MaybePromise,
NodeType,
Schema,
} from '@markdoc/markdoc';
import _Markdoc from '@markdoc/markdoc';
import type { AstroInstance } from 'astro';
import { heading } from './heading-ids.js';
type Render = AstroInstance['default'] | string;
export type AstroMarkdocConfig<C extends Record<string, any> = Record<string, any>> = Omit<
MarkdocConfig,
'tags' | 'nodes'
> &
Partial<{
tags: Record<string, Schema<Config, Render>>;
nodes: Partial<Record<NodeType, Schema<Config, Render>>>;
ctx: C;
extends: MaybePromise<ResolvedAstroMarkdocConfig>[];
}>;
export type ResolvedAstroMarkdocConfig = Omit<AstroMarkdocConfig, 'extends'>;
export const Markdoc = _Markdoc;
export const nodes = { ...Markdoc.nodes, heading };
export function defineMarkdocConfig(config: AstroMarkdocConfig): AstroMarkdocConfig {
return config;
}