UNPKG

cascade-cards-source-markdown

Version:

Cascade Cards Markdown data source adapter

37 lines (34 loc) 1.27 kB
import { DataSource, DataSourceContent } from 'cascade-cards-core'; interface MarkdownSourceOptions { /** Glob pattern to find markdown files like 'docs/subfolder/file.md' */ glob: string; /** Base directory to resolve relative paths (defaults to cwd) */ baseDir?: string; /** Whether to cache parsed files in memory */ cache?: boolean; /** Custom term resolver function */ termResolver?: (term: string) => string | null; /** Whether to extract links from markdown content */ extractLinks?: boolean; } declare class MarkdownSource implements DataSource { name: string; private options; private cache; private fileMap; private initialized; constructor(options: MarkdownSourceOptions); resolve(term: string): Promise<DataSourceContent | null>; private ensureInitialized; private defaultTermResolver; private pathToSlug; private parseMarkdownFile; private extractTitleFromMarkdown; private extractLinksFromContent; private toDataSourceContent; getAllTerms(): Promise<string[]>; clearCache(): Promise<void>; reloadFiles(): Promise<void>; } declare function markdownSource(options: MarkdownSourceOptions): MarkdownSource; export { MarkdownSource, markdownSource };