ExtractorDelegator
The ExtractorDelegator
class manages the delegation of content extraction to specific extractors. It itself is an extractor.
Extends
BaseExtractor
Methods
cleanContents()
Cleans the contents of a file by removing frontmatter, code blocks, and other irrelevant content.
Parameters
Parameter | Type | Description |
---|---|---|
contents | string | The content string to be cleaned. |
Returns
The cleaned content string.
Inherited from
BaseExtractor.cleanContents
Source
source/extract/BaseExtractor.ts:129
extract()
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.
Overrides
BaseExtractor.extract
Source
source/extract/ExtractorDelegator.ts:91
getEmbedContent()
Retrieves the content of an embedded block or section from a file.
Parameters
Parameter | Type | Description |
---|---|---|
reference | ReferenceCache | The reference cache object containing the link to the embedded content. |
Returns
A Promise that resolves to the content of the embedded block or section.
Inherited from
BaseExtractor.getEmbedContent
Source
source/extract/BaseExtractor.ts:149
replaceEmbeds()
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.
Inherited from
BaseExtractor.replaceEmbeds
Source
source/extract/BaseExtractor.ts:198
substituteBlockReferences()
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.
contents
substitutions
Inherited from
BaseExtractor.substituteBlockReferences
Source
source/extract/BaseExtractor.ts:74
Generated using typedoc-plugin-markdown and TypeDoc