Skip to content

EmbedExtensionsComponent.registerExtensions method

EmbedExtensionsComponent › registerExtensions

Registers the specified file extensions with the given embed type in the Obsidian app. The extensions will be automatically unregistered when the component is unloaded.

Signature:

registerExtensions(extensions: string[], embedCreator: EmbedCreator): void

Parameters:

ParameterTypeDescription
extensionsstring[]An array of file extensions to register.
embedCreatorEmbedCreatorThe embed creator function to associate with the extensions.

Returns: void

Example:

component.registerExtensions(['ext1', 'ext2'], (context, file, subpath) => new MyEmbedComponent(context, file, subpath));