Extracts content from a file based on the specified strategy and evergreen status.
This method delegates to specific extractors depending on the strategy provided.
If no strategy is specified, it defaults to extracting the raw contents of the file,
performing embed replacements, and cleaning the contents.
Parameters
Parameter
Type
Description
file?
TFile
The file from which to extract content.
metadata?
CachedMetadata
The cached metadata of the file.
strategy?
StrategyMetadata
The strategy to use for content extraction (optional).
Returns
A Promise that resolves to an array of FileContents objects.
Replaces embed references in the content with the actual embedded content.
This method iterates over each embed reference found in the metadata, retrieves the content
for that reference, and replaces the reference in the original content with the retrieved content.
Block references within the embed content are also substituted for markers.
It adjusts the offset for each subsequent replacement to account for the change in content length
after each replacement.
Parameters
Parameter
Type
Description
contents
string
The original content containing embed references.
metadata
CachedMetadata
The metadata object containing embeds and their positions.
Returns
A Promise that resolves to an object containing the modified content and an array of block reference substitutions.
Substitutes block references within the content.
This method scans the provided content for block reference markers (e.g., ^blockid)
and replaces them with Obsidian-style block reference links (![[title#^blockid]]).
It does something similar for headings. It also generates and substitutes temporary
placeholders for these block references which can be used for further processing.
Parameters
Parameter
Type
Description
title
string
The title of the file where the block references are located.
contents
string
The content string containing the block references to be substituted.
Returns
An object containing the array of block reference substitutions and the modified content.