import { FilterPattern } from '@rollup/pluginutils'; import { HighlighterOptions } from 'shiki'; import type MarkdownIt from 'markdown-it'; import { Plugin as Plugin_2 } from 'vite'; import { PluginSimple } from 'markdown-it'; import type { PluginWithOptions } from 'markdown-it'; import { RequestHandler } from '@sveltejs/kit'; import type { RuleBlock } from 'markdown-it/lib/parser_block'; import type { RuleInline } from 'markdown-it/lib/parser_inline'; import type Token from 'markdown-it/lib/token'; export declare type AddTopLevelHtmlTags = (data: { fileName: string; filePath: string; meta: MarkdownMeta; }) => string[] | undefined | null; export declare const anchorPlugin: PluginSimple; export declare type BlockElementRule = 'blockquote' | 'heading' | 'list_item' | 'ordered_list' | 'paragraph' | 'table' | 'bullet_list'; /** * Takes an absolute or relative file path and maps it to a relative path to `src/routes`, and * strips out rest params and layout ids `{[...1]}index{@layout-id}.md`. * * @example `src/routes/docs/[...1getting-started]/[...1]intro.md` = `docs/getting-started/intro.md` */ export declare function cleanFilePath(filePath: string): string; export declare function clearMarkdownCaches(): void; /** * Plugin to enable styled code fences with line numbers, syntax highlighting, etc. */ export declare const codePlugin: PluginSimple; export declare const containersPlugin: PluginWithOptions; export declare const createImportCodeBlockRule: () => RuleBlock; export declare function createMarkdownParser(options?: MarkdownParserOptions): Promise; export declare function createMetaRequestHandler(options?: CreateMetaRequestHandlerOptions): RequestHandler; export declare type CreateMetaRequestHandlerOptions = { include?: FilterPattern; exclude?: FilterPattern; debug?: boolean; } & HandleMetaRequestOptions; export declare const createShikiPlugin: (options?: HighlighterOptions) => Promise; export declare function createSidebarRequestHandler(options?: CreateSidebarRequestHandlerOptions): RequestHandler; export declare type CreateSidebarRequestHandlerOptions = { include?: FilterPattern; exclude?: FilterPattern; debug?: boolean; } & HandleSidebarRequestOptions; /** * Forked and modified from `markdown-it-toc-done-right`. * * - Remove the `inlineOptions` support. * - Use `markdown-it` default renderer to render token whenever possible. * * @see https://github.com/nagaozen/markdown-it-toc-done-right */ export declare const createTocBlockRule: ({ pattern }: { pattern: RegExp; }) => RuleBlock; /** * Replacing the default `htmlBlock` rule to allow using custom components in markdown. */ export declare const customComponentPlugin: PluginSimple; export declare const emojiPlugin: PluginSimple; /** * Extracting markdown headers to `env`. Would be used for generating sidebar nav and toc. */ export declare const extractHeadersPlugin: PluginSimple; /** * Extracting markdown title to parser env. */ export declare const extractTitlePlugin: PluginSimple; export declare type FalsyValue = false | NoValue; export declare type FileResolver = (slug: string, helpers: { resolve: typeof resolveSlug; }) => ResolvedFile | FalsyValue | Promise; export declare function getFrontmatter(source: string): Record; /** * Careful this function will throw if it can't match the `slug` param to a file. */ export declare function handleMetaRequest(slugParam: string, options?: HandleMetaRequestOptions): Promise; export declare type HandleMetaRequestOptions = { extensions?: string[]; filter?: (file: string) => boolean; resolve?: FileResolver | null | (FileResolver | FalsyValue)[]; transform?: MetaTransform | null | (MetaTransform | FalsyValue)[]; }; /** * Careful this function will throw if it can't match the `dir` param to a directory. */ export declare function handleSidebarRequest(dirParam: string, options?: HandleSidebarRequestOptions): Promise<{ links: Record; }>; export declare type HandleSidebarRequestOptions = { extensions?: string[]; filter?: (file: string) => boolean; resolveTitle?: SidebarMetaResolver; resolveCategory?: SidebarMetaResolver; resolveSlug?: SidebarMetaResolver; formatCategoryName?: (name: string, helpers: { format: (name: string) => string; }) => string; }; /** * Language type for syntax highlight. */ export declare type HighlightLanguage = { /** * Name of the language. * * The name to be used for the class name, e.g. `class="language-typescript"`. */ name: string; /** * Extension of the language. * * The file extension, which will be used for the class name, e.g. `class="ext-ts"` */ ext: string; /** * Aliases that point to this language. Do not conflict with other languages. */ aliases: string[]; }; export declare type HighlightLinesRange = [number, number]; export declare type HighlightPluginOptions = HighlighterOptions; /** * Avoid rendering Svelte script/style blocks. Extract them into `env`, and hoist them root level. */ export declare const hoistTagsPlugin: PluginSimple; export declare const HTML_OPEN_CLOSE_TAG_RE: RegExp; export declare const HTML_TAG_RE: RegExp; export declare const htmlBlockRule: (customSequences?: HTMLBlockSequence[]) => RuleBlock; /** * An array of opening and corresponding closing sequences for html tags. The last array value * defines whether it can terminate a paragraph or not. */ export declare type HTMLBlockSequence = [RegExp, RegExp, boolean]; export declare const htmlInlineRule: RuleInline; export declare const importCodePlugin: PluginSimple; export declare type ImportCodeTokenMeta = { importPath: string; lineStart: number; lineEnd?: number; }; export declare type InlineElementRule = 'emphasized' | 'image' | 'strikethrough' | 'strong'; /** * According to markdown spec, all non-block html tags are treated as "inline" * tags (wrapped with

), including those "unknown" tags. * * Therefore, `markdown-it` processes "inline" tags and "unknown" tags in the same * way, and does not care if a tag is "inline" or "unknown". * * As we want to take those "unknown" tags as custom components, we should treat them as * "block" tags. So we have to distinguish between "inline" and "unknown" tags ourselves. * * The inline tags list comes from MDN. * * @see https://spec.commonmark.org/0.29/#raw-html * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements */ export declare const inlineTags: string[]; export declare function kebabToTitleCase(str: string): string; export declare const kitDocsHighlightPlugin: (options?: HighlightPluginOptions) => Plugin_2; export declare function kitDocsMarkdownPlugin(options?: MarkdownPluginOptions): Plugin_2; declare const kitDocsPlugin: (options?: KitDocsPluginOptions) => Plugin_2[]; export default kitDocsPlugin; export { kitDocsPlugin } export declare type KitDocsPluginOptions = { highlight?: false; shiki?: HighlighterOptions; markdown?: MarkdownPluginOptions; }; export declare const languageBash: HighlightLanguage; export declare const languageCsharp: HighlightLanguage; export declare const languageDocker: HighlightLanguage; export declare const languageFsharp: HighlightLanguage; export declare const languageJavascript: HighlightLanguage; export declare const languageKotlin: HighlightLanguage; export declare const languageMarkdown: HighlightLanguage; export declare const languagePython: HighlightLanguage; export declare const languageRuby: HighlightLanguage; export declare const languageRust: HighlightLanguage; export declare const languageStylus: HighlightLanguage; export declare const languageTypescript: HighlightLanguage; export declare const languageYaml: HighlightLanguage; /** * Resolves link URLs. */ export declare const linksPlugin: PluginSimple; export declare type MarkdownBlockComponent = { name: string; type: 'block'; rule: BlockElementRule; }; export declare type MarkdownComponentContainer = { name?: string; marker?: string; renderer?(componentName: string): (tokens: Token[], idx: number) => string; }; export declare type MarkdownComponents = (MarkdownInlineComponent | MarkdownBlockComponent | MarkdownCustomComponent)[]; export declare type MarkdownCustomComponent = { name: string; type: 'custom'; container?: MarkdownComponentContainer; }; export declare type MarkdownFrontmatter = Record; export declare type MarkdownHeader = { level: number; title: string; slug: string; children?: MarkdownHeader[]; }; export declare type MarkdownInlineComponent = { name: string; type: 'inline'; rule: InlineElementRule; }; export declare type MarkdownLinks = string[]; export declare type MarkdownMeta = { title: string; description: string; excerpt: string; headers: MarkdownHeader[]; frontmatter: MarkdownFrontmatter; lastUpdated: number; }; export declare type MarkdownParser = MarkdownIt; /** * The `env` object to be passed to `markdown-it` render function. */ export declare type MarkdownParserEnv = MarkdownParserEnvInput & MarkdownParserEnvOutput; /** * Metadata provided to markdown parser. */ export declare type MarkdownParserEnvInput = { /** Absolute system file path of the markdown file. */ filePath?: string | null; /** Frontmatter of the markdown file. */ frontmatter?: MarkdownFrontmatter; }; /** * Resources extracted from markdown parser. */ export declare type MarkdownParserEnvOutput = { /** Headers that are extracted by `extractHeadersPlugin`. */ headers?: MarkdownHeader[]; /** Imported files that are extracted by `importCodePlugin`. */ importedFiles?: string[]; /** Hoisted `