/** * Markmv - TypeScript library for markdown file operations with intelligent link refactoring * * This library provides programmatic access to all markmv functionality for use in scripts, build * processes, and other Node.js applications. * * @example * Basic usage * ```typescript * import { FileOperations } from 'markmv'; * * const fileOps = new FileOperations(); * const result = await fileOps.moveFile('old.md', 'new.md'); * console.log(`Moved file successfully: ${result.success}`); * ``` * * @example * Advanced usage with options * ```typescript * import { FileOperations, type MoveOperationOptions } from 'markmv'; * * const fileOps = new FileOperations(); * const options: MoveOperationOptions = { * dryRun: true, * verbose: true * }; * * const result = await fileOps.moveFile('docs/old.md', 'docs/new.md', options); * if (result.success) { * console.log(`Would modify ${result.modifiedFiles.length} files`); * result.changes.forEach(change => { * console.log(`${change.type}: ${change.filePath}`); * }); * } * ``` */ import { FileOperations } from "./core/file-operations.js"; import type { MoveOperationOptions, OperationResult } from "./types/operations.js"; export { FileOperations }; export { LinkParser } from "./core/link-parser.js"; export { LinkRefactorer } from "./core/link-refactorer.js"; export { LinkValidator } from "./core/link-validator.js"; export { LinkConverter } from "./core/link-converter.js"; export { LinkGraphGenerator } from "./core/link-graph-generator.js"; export { resolveWikilinks, createWikilinkResolver, findDuplicateNoteStems, computeNoteStemCounts, type ObsidianAmbiguity, type DuplicateNoteStem, type WikilinkResolution, } from "./core/obsidian-vault.js"; export { suggestLinkFixes, type LinkSuggestion, } from "./core/link-suggester.js"; export { findLocalImages, findInlineImages, parseImageDataUri, imageMimeTypeForExtension, imageExtensionForMimeType, renderImageMarkdown, type ImageLinkOccurrence, type ParsedImageDataUri, type SpanReplacement, } from "./core/image-inline.js"; export { embedCommand, type EmbedOptions, type EmbedSummary, } from "./commands/embed.js"; export { extractCommand, type ExtractOptions, type ExtractSummary, } from "./commands/extract.js"; export { waybackCommand, toWaybackUrl, type WaybackOptions, type WaybackResult, type WaybackFileResult, type WaybackLinkChange, } from "./commands/wayback.js"; export { refactorIndex, refactorIndexCommand, type IndexConvention, type RefactorIndexOptions, type RefactorIndexCliOptions, type RefactorIndexResult, } from "./commands/refactor-index.js"; export { treeCommand, scanMarkdownTree, buildFileTree, renderTreeAscii, computeTreeStatistics, countWords, type ScanOptions, type ScannedMarkdownFile, type TreeDirectoryNode, type TreeFileNode, type TreeStatistics, type TreeFormat, type TreeCliOptions, } from "./commands/tree.js"; export { DependencyGraph } from "./core/dependency-graph.js"; export { ContentJoiner } from "./core/content-joiner.js"; export { ContentSplitter } from "./core/content-splitter.js"; export { FileUtils } from "./utils/file-utils.js"; export { PathUtils } from "./utils/path-utils.js"; export { TransactionManager } from "./utils/transaction-manager.js"; export { TocGenerator } from "./utils/toc-generator.js"; export { BaseJoinStrategy, DependencyOrderJoinStrategy, AlphabeticalJoinStrategy, ManualOrderJoinStrategy, ChronologicalJoinStrategy, } from "./strategies/join-strategies.js"; export { BaseMergeStrategy, AppendMergeStrategy, PrependMergeStrategy, InteractiveMergeStrategy, } from "./strategies/merge-strategies.js"; export { BaseSplitStrategy, HeaderBasedSplitStrategy, SizeBasedSplitStrategy, ManualSplitStrategy, LineBasedSplitStrategy, } from "./strategies/split-strategies.js"; export { convertCommand } from "./commands/convert.js"; export { graphCommand, generateGraph } from "./commands/graph.js"; export { indexCommand } from "./commands/index.js"; export { tocCommand, generateToc as generateTocForFiles, } from "./commands/toc.js"; export { validateCommand, validateLinks, planLinkFixes, applyLinkFix, type ValidateCliOptions, type ValidateResult, type PlannedLinkFix, type FixPrompter, } from "./commands/validate.js"; export type { MarkdownLink, ParsedMarkdownFile, LinkType, LinkStyle, } from "./types/links.js"; export type { OperationResult, OperationChange, MoveOperationOptions, OperationOptions, SplitOperationOptions, JoinOperationOptions, MergeOperationOptions, ConvertOperationOptions, BarrelOperationOptions, } from "./types/operations.js"; export type { GraphOperationOptions, GraphCliOptions, GraphResult, } from "./commands/graph.js"; export type { LinkGraphOptions, GraphNode, GraphEdge, LinkGraph, GraphOutputFormat, } from "./core/link-graph-generator.js"; export type { IndexOptions, FileMetadata, IndexableFile, } from "./commands/index.js"; export type { TocOperationOptions, TocCliOptions, TocResult, } from "./commands/toc.js"; export type { TocOptions, TocResult as TocGeneratorResult, MarkdownHeading, } from "./utils/toc-generator.js"; export type { JoinSection, JoinResult, JoinConflict, JoinStrategyOptions, } from "./strategies/join-strategies.js"; export type { MergeSection, MergeResult, MergeConflict, MergeStrategyOptions, } from "./strategies/merge-strategies.js"; export type { SplitSection, SplitResult, SplitStrategyOptions, } from "./strategies/split-strategies.js"; /** * Main entry point for the markmv library * * Creates a new FileOperations instance for performing markdown file operations. This is the * recommended way to get started with the library. * * @example * ```typescript * import { createMarkMv } from 'markmv'; * * const markmv = createMarkMv(); * const result = await markmv.moveFile('old.md', 'new.md'); * ```; * * @returns A new FileOperations instance * * @group Core API */ export declare function createMarkMv(): FileOperations; /** * Convenience function for moving a single file: a markdown file or a non-markdown asset (such as * an image) that markdown files link to. Any markdown file that references the moved file has its * link updated to the new location. * * @example * ```typescript * import { moveFile } from 'markmv'; * * const result = await moveFile('docs/old.md', 'docs/new.md', { * dryRun: true * }); * ```; * * @param sourcePath - The current file path * @param destinationPath - The target file path * @param options - Optional configuration * * @returns Promise resolving to operation result * * @group Core API */ export declare function moveFile(sourcePath: string, destinationPath: string, options?: MoveOperationOptions): Promise; /** * Convenience function for moving multiple files (markdown files, non-markdown assets, or a mix of * both) in a single batch * * @example * ```typescript * import { moveFiles } from 'markmv'; * * const result = await moveFiles([ * { source: 'old1.md', destination: 'new1.md' }, * { source: 'old2.md', destination: 'new2.md' } * ]); * ```; * * @param moves - Array of source/destination pairs * @param options - Optional configuration * * @returns Promise resolving to operation result * * @group Core API */ export declare function moveFiles(moves: { source: string; destination: string; }[], options?: MoveOperationOptions): Promise; /** * Convenience function for validating markdown file operations * * @example * ```typescript * import { moveFile, validateOperation } from 'markmv'; * * const result = await moveFile('old.md', 'new.md'); * const validation = await validateOperation(result); * * if (!validation.valid) { * console.error(`Found ${validation.brokenLinks} broken links`); * } * ``` * * @param result - The operation result to validate * * @returns Promise resolving to validation result * * @group Core API */ export declare function validateOperation(result: OperationResult): Promise<{ valid: boolean; brokenLinks: number; errors: string[]; }>; /** * Generate table of contents for markdown content * * @example * ```typescript * import { generateToc } from 'markmv'; * * const content = '# Title\n## Section 1\n### Subsection'; * const result = await generateToc(content, { minDepth: 2 }); * console.log(result.toc); * ```; * * @param content - Markdown content to analyze * @param options - TOC generation options * * @returns Promise resolving to TOC result * * @group Utilities */ export declare function generateToc(content: string, options?: import("./utils/toc-generator.js").TocOptions): Promise; /** * Generate index files with optional table of contents * * @example * ```typescript * import { generateIndex } from 'markmv'; * * const options = { * type: 'links', * strategy: 'directory', * generateToc: true, * tocOptions: { minDepth: 2 } * }; * await generateIndex('.', options); * ```; * * @param directory - Directory to generate index for * @param options - Index generation options * * @returns Promise resolving when index generation is complete * * @group Commands */ export declare function generateIndex(directory: string, options: import("./commands/index.js").IndexOptions): Promise; /** * Generate barrel files for themed content aggregation (alias for generateIndex) * * @example * ```typescript * import { generateBarrel } from 'markmv'; * * const options = { * type: 'links', * strategy: 'directory', * name: 'api-docs.md', * generateToc: true * }; * await generateBarrel('docs/', options); * ```; * * @param directory - Directory to generate barrel files for * @param options - Barrel generation options (same as IndexOptions) * * @returns Promise resolving when barrel generation is complete * * @group Commands */ export declare function generateBarrel(directory: string, options: import("./commands/index.js").IndexOptions): Promise; /** * Generate interactive link graphs from markdown file relationships * * @example * Basic graph generation * ```typescript * import { generateLinkGraph } from 'markmv'; * * const result = await generateLinkGraph(['docs/**\/*.md'], { * format: 'mermaid', * includeExternal: false * }); * * console.log('Generated Mermaid diagram:'); * console.log(result.content); * ``` * * @example * Interactive HTML visualization * ```typescript * import { generateLinkGraph } from 'markmv'; * * const result = await generateLinkGraph(['**\/*.md'], { * format: 'html', * output: 'visualization.html', * includeImages: true * }); * * console.log('Interactive graph saved to: ' + result.outputFile); * ``` * * @param patterns - File patterns to analyze (supports globs) * @param options - Graph generation options * * @returns Promise resolving to graph generation result * * @group Commands */ export declare function generateLinkGraph(patterns: string[], options?: import("./commands/graph.js").GraphOperationOptions): Promise; /** * Test function to demonstrate auto-exposure pattern * * @example * ```typescript * import { testAutoExposure } from 'markmv'; * * const result = await testAutoExposure('Hello World'); * console.log(result.message); // "Echo: Hello World" * ```; * * @param input - The input message to echo * * @returns Promise resolving to echo result * * @group Testing */ export declare function testAutoExposure(input: string): Promise<{ message: string; timestamp: string; success: boolean; }>; //# sourceMappingURL=index.d.ts.map