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.
Places the source content after the target content.
Frontmatter is stripped from both bodies, the bodies are joined by the separator, and frontmatter is merged when mergeFrontmatter is on (otherwise the target's is kept). Duplicate headers are recorded as auto-resolved conflicts and left in place. When createTransclusions is on, a transclusion reference to the source is appended instead of its content, unless it would form a loop, in which case a warning is added and the content is appended.
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 appends source content to the end of target content.
Simply adds the source file content to the end of the target file, with optional separator and frontmatter merging. This is the simplest merge strategy and works well for accumulating content.
Example
Append merge with transclusions