UNPKG

markmv

Version:

TypeScript CLI for markdown file operations with intelligent link refactoring

67 lines 2.19 kB
import type { ParsedMarkdownFile } from '../types/links.js'; /** * Parser for extracting and analyzing markdown links and references. * * This class uses the unified/remark ecosystem to parse markdown files and extract comprehensive * link information including inline links, images, reference-style links, and link definitions. * * @category Core * * @example * Basic usage * ```typescript * const parser = new LinkParser(); * const parsed = await parser.parseFile('docs/readme.md'); * * console.log(`Found ${parsed.links.length} links`); * parsed.links.forEach(link => { * console.log(`${link.type}: ${link.href} (line ${link.line})`); * }); * ``` * * @example * Link validation * ```typescript * const parser = new LinkParser(); * const parsed = await parser.parseFile('guide.md'); * * const localLinks = parsed.links.filter(link => * link.type === 'internal' && !link.href.startsWith('http') * ); * * for (const link of localLinks) { * const exists = await parser.validateInternalLink(link, parsed.filePath); * if (!exists) { * console.warn(`Broken link: ${link.href} at line ${link.line}`); * } * } * ``` */ export declare class LinkParser { private processor; /** * Parse a markdown file and extract all links, references, and metadata. * * @example * ```typescript * const parser = new LinkParser(); * const result = await parser.parseFile('docs/api.md'); * * console.log(`File: ${result.filePath}`); * console.log(`Links: ${result.links.length}`); * console.log(`References: ${result.references.length}`); * ``` * * @param filePath - Path to the markdown file to parse * * @returns Promise resolving to comprehensive file analysis */ parseFile(filePath: string): Promise<ParsedMarkdownFile>; private determineLinkType; private resolveInternalPath; private resolveClaudeImportPath; private extractDependencies; parseDirectory(dirPath: string, extensions?: string[]): Promise<ParsedMarkdownFile[]>; private findMarkdownFiles; } //# sourceMappingURL=link-parser.d.ts.map