@vttforge/core / EnricherRegistration
Interface: EnricherRegistration
The enriched element Foundry hands to onRender.
Properties
enricher
readonlyenricher: (match,options?) =>HTMLElement|Promise<HTMLElement|null> |null
Build the replacement for one match. Return null to leave the text alone, the usual answer when the thing referenced does not exist or the reader is not allowed to see it.
Parameters
match
RegExpMatchArray
options?
unknown
Returns
HTMLElement | Promise<HTMLElement | null> | null
id
readonlyid:string
Name for this enricher, unique within the package.
Registered as <package id>.<id>. Foundry keeps every enricher in one namespace, so the prefix is what stops a link from colliding with the link of whatever else the world has installed.
onRender?
readonlyoptionalonRender?: (element) =>void
Runs when enriched content enters the DOM. The place to bind listeners: it fires on every render, so the markup and its behaviour stay declared together instead of in a separate hook.
Parameters
element
HTMLElement
Returns
void
pattern
readonlypattern:RegExp
The pattern to match. Must carry the g flag: enrichment runs it through matchAll, which refuses a non-global regex.
replaceParent?
readonlyoptionalreplaceParent?:boolean
Replace the whole parent element rather than just the matched text.