Signature
Parameters
Array of external diagram definitions to register.
Configuration options for registration.
Return value
Promise<void> - Resolves when registration is complete (and diagrams are loaded if lazyLoad is false).
Examples
Basic external diagram registration
Registering multiple diagrams
Eager loading
Advanced detector with config
Complete diagram implementation example
Using with initialization
Usage notes
- Must be called before attempting to render diagrams of the registered types
- Detectors are checked in registration order
- If multiple detectors match, the first registered one is used
- With
lazyLoad: true(default), diagram code is only loaded when first needed - With
lazyLoad: false, all diagram implementations are loaded immediately - External diagrams have access to the same configuration system as built-in diagrams
Diagram definition structure
Your diagram loader must return an object with:id: String identifier matching the registrationdiagram: Object containing:db: Database/state management objectrenderer: Object withdraw()methodparser: Object withparse()methodstyles: Optional function returning CSSinit: Optional initialization function
Related methods
- registerIconPacks() - Register custom icon packs
- registerLayoutLoaders() - Register layout algorithms
- initialize() - Configure Mermaid