markmv - v1.41.7
    Preparing search index...

    Class ManualOrderJoinStrategy

    Join strategy that uses a custom manual ordering with alphabetical fallback.

    Allows explicit specification of file order through the customOrder option. Files not specified in the custom order are appended in alphabetical order. This provides maximum control over the final document structure.

    Manual ordering with fallback

      const strategy = new ManualOrderJoinStrategy({
    customOrder: ['intro.md', 'main-content.md', 'conclusion.md'],
    mergeFrontmatter: true
    });

    // Files will be ordered as specified, with any others alphabetically
    const result = await strategy.join(sections);

    Hierarchy (View Summary)

    Index

    The effective options for this strategy: the supplied options layered over the defaults set in the constructor.

    • Removes repeated links from combined content.

      The first occurrence of each markdown link (same text and target) and each bare URL is kept. A repeated markdown link is replaced by its link text (or its URL when the text is empty), and a repeated bare URL is deleted.

      Parameters

      • content: string

        The combined document content.

      Returns { content: string; removedLinks: string[] }

      The de-duplicated content and the occurrences that were removed.

      • content: string

        The content with repeated links replaced or removed.

      • removedLinks: string[]

        Each removed occurrence exactly as it appeared, in document order.

    • Detects conflicts between sections.

      Reports a duplicate-headers conflict for each header (compared case-insensitively) that appears in more than one section, and a frontmatter-merge conflict for each frontmatter key present in more than one section.

      Parameters

      • sections: readonly JoinSection[]

        The sections to compare.

      Returns JoinConflict[]

      One conflict per duplicated header or frontmatter key, naming the files involved.

    • Extracts the text of every markdown header in a document.

      Parameters

      • content: string

        The markdown content to scan.

      Returns string[]

      The header texts in document order, without the leading # markers.

    • Extracts a title from a document.

      A title: frontmatter line takes precedence, with any quote characters removed. Otherwise the text of the first markdown header in the content is used.

      Parameters

      • content: string

        The document body to scan for a header.

      • Optionalfrontmatter: string

        The raw frontmatter block, if the document has one.

      Returns string | undefined

      The title, or undefined when there is neither a frontmatter title nor a header.

    • Joins sections in the order given by the customOrder option.

      Sections named in customOrder come first, in that order. A named file with no matching section adds a warning. Remaining sections follow in case-insensitive alphabetical order by title, using the file path for a section with no title.

      Parameters

      • sections: readonly JoinSection[]

        The sections to join.

      Returns Promise<JoinResult>

      The joined result, or a failed result with errors populated if joining throws.

    • Merges the frontmatter blocks of several sections into one block.

      The tags, categories and keywords keys are collected across all sections as de-duplicated lists. Differing title values are combined with &. Every other key keeps the first value found, and a purely numeric value is written as a number.

      Parameters

      • sections: readonly JoinSection[]

        The sections whose frontmatter is merged, in output order.

      Returns string

      A --- delimited frontmatter block, or an empty string when no section supplies any keys.

    • Returns title unless it is undefined or the empty string, in which case filePath is used. An empty title is treated as "no title supplied" rather than a meaningful value to sort or display by.

      Parameters

      • title: string | undefined
      • filePath: string

      Returns string