---
title: Using the library from other plugins
url: https://lhero.org/portfolio/lh-mermaid/using-the-library-from-other-plugins/
date: 2026-10-20T21:40:49+11:00
modified: 2026-10-20T21:40:49+11:00
type: lh-portfolio-doc
---

- **Part of:** [LH Mermaid](https://lhero.org/portfolio/lh-mermaid/)

LH Mermaid bundles Mermaid.js (`assets/js/mermaid.min.js`, version in `Lh_Mermaid::BUNDLED_MERMAID_VERSION`) so other plugins don’t each ship a copy. The library is registered but never enqueued globally; a plugin asks for it only when it knows a diagram is on the request. Guard calls with `class_exists( 'Lh_Mermaid' )`.

| Method | Use |
|---|---|
| `Lh_Mermaid::enqueue( $in_footer = true )` | Enqueue the library. Any element with the `mermaid` class is drawn on page load. |
| `Lh_Mermaid::script_handle()` | The script handle. A page that never calls `wp_footer()` prints the library itself with `wp_scripts()->do_items( array( Lh_Mermaid::script_handle() ) )` after `enqueue()`. |
| `Lh_Mermaid::script_url()` | URL of the bundled library. |
| `Lh_Mermaid::block_name()` | The block’s name (`lh-mermaid/diagram`), for `has_block()` checks and allowed-block lists. |

Current users: the Schema Diagram block in LH Schema Tools, and LH Presentations, which prints the library in its Reveal.js page and draws diagrams per slide with `mermaid.run()` after `mermaid.initialize( { startOnLoad: false } )`.