markmv - v1.41.7
    Preparing search index...

    Class AlphabeticalJoinStrategy

    Join strategy that orders content alphabetically by title or filename.

    Provides simple, predictable ordering by sorting files alphabetically based on their extracted title (from frontmatter or first header) or falling back to the filename if no title is available.

    Alphabetical joining

      const strategy = new AlphabeticalJoinStrategy({
    separator: '\n\n<!-- Next Section -->\n\n'
    });

    const result = await strategy.join(sections);
    console.log(`Files ordered: ${result.sourceFiles.join(', ')}`);

    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.

    • 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