import { Config, Schema } from '@markdoc/markdoc'; export { default as Markdoc } from '@markdoc/markdoc'; import { PreprocessorGroup } from 'svelte/compiler'; import { Component } from 'svelte'; /** * The validation levels for the preprocessor. */ type ValidationLevel = "debug" | "info" | "warning" | "error" | "critical"; /** * Configuration options for the Markdoc preprocessor */ interface Options { /** * Enable adding Markdown comments to your documents. * @default true */ comments?: boolean; /** * Specify a directory to import Svelte components to customize Markdoc Nodes and Tags. * Use import paths and aliases that Svelte can resolve. * @default "$lib/components" */ components?: string; /** * File extensions to preprocess. * @default [".mdoc", ".md"] */ extensions?: string[]; /** * Import an object of functions to use as Markdoc Functions. * Overwrites functions with the same name from 'schema' directory. * @default undefined */ functions?: Config["functions"]; /** * Whether to add IDs to all headings and generate and export a list of headings. * @default false */ headingIds?: boolean | SluggerType; /** * Specify a Svelte component to use as a layout for the Markdoc file. * Use import paths and aliases that Svelte can resolve. * @default undefined */ layout?: string; /** * Enable autoconvert URL-like text to links. * @default false */ linkify?: boolean; /** * Import an object of nodes to use as Markdoc Nodes. * Overwrites nodes with the same name from 'schema' directory. * @default undefined */ nodes?: Config["nodes"]; /** * Specify a directory to import files with 'extensions' as Markdoc Partials. * Default is to load partials from 'schema' directory. * Overwrites partials with the same name from 'schema' directory. * Path is relative to Svelte project root. * @default undefined */ partials?: string; /** * Specify a directory to import folders or files to use as Markdoc Schemas. * Path is relative to Svelte project root. * @default ["./markdoc", "./src/markdoc"] */ schema?: string; /** * Import an object of tags to use as Markdoc Tags. * Overwrites tags with the same name from 'schema' directory. * @default undefined */ tags?: Config["tags"]; /** * Enable some language-neutral replacement + quotes beautification. * @default false */ typographer?: boolean; /** * Sets the level invalid parsing will throw a preprocess error. * @default "error" */ validationLevel?: ValidationLevel; /** * Import an object of variables to use as Markdoc Variables. * Overwrites variables with the same name from 'schema' directory. * @default undefined */ variables?: Config["variables"]; } /** * Represents the structure of an imported Markdoc module. */ interface MarkdocModule { /** * The default Svelte component exported by the Markdoc file. */ default: Component; /** * The slug of the Markdoc file. */ slug: string; /** * Optional frontmatter extracted from the Markdoc file. */ frontmatter?: { [key: string]: string; }; /** * Optional list of headings from the Markdoc file. */ headings?: Heading[]; } type SluggerType = (value: string) => string; interface MarkdocSvelteConfig extends Config { headingSlugger?: SluggerType; } interface Heading { /** * The heading level (1-6) */ level: number; /** * The heading text content */ title: string; /** * The heading id attribute */ id?: string; } declare const heading: Schema; /** * Creates a Svelte preprocessor for Markdoc files * @param {Options} options - Configuration options for the Markdoc preprocessor * @returns {PreprocessorGroup} A Svelte preprocessor for Markdoc files */ declare const markdocPreprocess: (options?: Options) => PreprocessorGroup; export { heading as headingNode, markdocPreprocess }; export type { MarkdocSvelteConfig as Config, MarkdocModule };