Creates a merge strategy.
The defaults are automatic conflict resolution, a blank line between merged sections, no transclusions, frontmatter merging, structure preservation, the ![[{file}#{section}]] transclusion template and a maximum transclusion depth. 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.
ProtectedcreateBuilds a transclusion reference from the configured transclusionTemplate.
The .md extension is dropped from the file name. Without a section, the #{section} part of the template is removed.
The file to reference.
Optionalsection: string
The section within the file, if any.
The transclusion text.
ProtecteddetectDetects whether transcluding the source into the target would create a loop.
A loop is reported when any existing transclusion mentions the target file name, or when the source and target are the same file.
The path of the file being merged into.
The path of the file that would be transcluded.
The transclusion references already in the target.
True when a loop would result.
ProtectedextractExtracts every markdown header from content.
The markdown content to scan.
One entry per header, in document order.
The header level, equal to the number of # characters.
The one-based line number of the header.
The header text, without the # markers.
ProtectedextractExtracts Obsidian transclusions (![[file]] or ![[file#section]]) from content.
The markdown content to scan.
One entry per transclusion, in document order.
The referenced file, with a .md extension added when the reference had none.
The one-based line number on which the transclusion appears.
The full transclusion text as written, for example ![[notes#intro]].
Optionalsection?: stringThe referenced section, when the reference includes one after #.
ProtectedfindFinds source headers that also exist in the target.
Headers match when their text is equal ignoring case and they have the same level.
The target's content.
The source's content.
One entry per colliding source header.
The text of the source header.
The one-based line of the header in the source.
The one-based line of the matching header in the target.
Merges the files while recording each decision point as an unresolved conflict.
Every duplicate header becomes a header-collision conflict and every source header becomes a content-overlap placement conflict, all marked as not auto-resolved. Two warnings state that manual resolution is required. The returned content is a fallback: the target, a MERGE CONFLICT comment and the source, each joined by the separator, with frontmatter merged when mergeFrontmatter is on.
The full content of the file being merged into, including any frontmatter.
The full content of the file being merged from, including any frontmatter.
The path of the target file.
The path of the source file.
The merged result, or a failed result with errors populated and the target content returned unchanged if merging throws.
ProtectedmergeMerges the frontmatter of the target and source.
When only one side has frontmatter it is returned unchanged. Otherwise, for keys present on both sides the target's value wins, except that tags, categories and keywords are combined as de-duplicated lists when both sides hold lists.
The target's raw frontmatter block, or an empty string.
The source's raw frontmatter block, or an empty string.
The merged frontmatter block, or an empty string when neither side has any.
Merge strategy that provides intelligent conflict detection and resolution.
Analyzes both files to detect potential conflicts such as duplicate headers, overlapping content, or structural issues. Provides automatic resolution where possible and clear reporting of conflicts that need manual attention.
Example
Interactive merge with conflict resolution