markmv - v1.26.2
    Preparing search index...

    Class ContentJoiner

    Combines multiple markdown files into a single file using configurable strategies.

    The ContentJoiner provides intelligent merging of markdown content with support for different ordering strategies, header management, and frontmatter handling. It can handle complex scenarios like dependency resolution and conflicting content.

    Basic file joining

    const joiner = new ContentJoiner();
    const result = await joiner.joinFiles(
    ['intro.md', 'setup.md', 'usage.md'],
    {
    outputPath: 'complete-guide.md',
    strategy: 'alphabetical',
    dryRun: false
    }
    );

    if (result.success) {
    console.log(`Created ${result.createdFiles[0]}`);
    }

    Advanced joining with dependency ordering

    const joiner = new ContentJoiner();
    const result = await joiner.joinFiles(
    ['api.md', 'examples.md', 'getting-started.md'],
    {
    outputPath: 'documentation.md',
    strategy: 'dependency',
    preserveHeaders: true,
    handleFrontmatter: 'merge'
    }
    );
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Joins multiple markdown files into a single output file.

      This method processes the input files according to the specified strategy, handles header levels, manages frontmatter, and ensures proper link resolution. It supports various joining strategies including alphabetical, dependency-based, chronological, and manual ordering.

      Parameters

      • filePaths: string[]

        Array of file paths to join together

      • options: JoinOperationOptions

        Configuration options for the join operation

      Returns Promise<OperationResult>

      Promise resolving to operation result with success status and file changes

        const result = await joiner.joinFiles(
      ['chapter1.md', 'chapter2.md', 'chapter3.md'],
      {
      outputPath: 'book.md',
      strategy: 'manual', // Preserve input order
      headerLevelOffset: 1, // Shift headers down one level
      preserveHeaders: true,
      handleFrontmatter: 'first' // Use first file's frontmatter
      }
      );