AbstractCreates a join strategy.
The defaults are dependency ordering, a --- rule between sections, frontmatter merging, link deduplication and structure preservation, with automatic header conflict resolution off. Any supplied option overrides its default.
Options that override the defaults.
ProtectedoptionsThe effective options for this strategy: the supplied options layered over the defaults set in the constructor.
ProtecteddeduplicateRemoves 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.
The combined document content.
The de-duplicated content and the occurrences that were removed.
The content with repeated links replaced or removed.
Each removed occurrence exactly as it appeared, in document order.
ProtecteddetectDetects 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.
The sections to compare.
One conflict per duplicated header or frontmatter key, naming the files involved.
ProtectedextractExtracts the text of every markdown header in a document.
The markdown content to scan.
The header texts in document order, without the leading # markers.
ProtectedextractExtracts 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.
The document body to scan for a header.
Optionalfrontmatter: string
The raw frontmatter block, if the document has one.
The title, or undefined when there is neither a frontmatter title nor a header.
AbstractjoinOrders the sections and combines them into a single document.
Each concrete strategy decides the section order. Conflicts between sections are reported in the result rather than thrown, and a failure while joining is reported through errors with success set to false.
The sections to join, one per source file.
The combined content, merged frontmatter (when enabled), the source files in their final order, and any conflicts, warnings, errors and removed duplicate links.
ProtectedmergeMerges 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.
The sections whose frontmatter is merged, in output order.
A --- delimited frontmatter block, or an empty string when no section supplies any keys.
ProtectedtitleReturns 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.
Abstract base class for all join strategies.
Provides common functionality for joining markdown files including frontmatter merging, conflict detection, and link deduplication. Concrete strategies implement specific ordering algorithms.
Example
Implementing a custom join strategy