Integration of Mermaid diagrams.
  • JavaScript 68.8%
  • TypeScript 29.7%
  • CSS 1%
  • Shell 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
oliver.maklott 62ef992451
All checks were successful
Publish / dev-image (push) Successful in 1s
Publish / test (push) Successful in 49s
Publish / pack-and-publish (push) Successful in 8s
Merge pull request 'Embed options declared by the pack. Release 0.8.0.' (#6) from pack-declares-2026-11 into main
2026-11-15 10:56:02 +01:00
.forgejo/workflows Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
.githooks Sub-repo fmt/lint pre-push rollout 2026-08-29 15:42:55 +02:00
client The embed-options handler declares its path form (role and title). Release 0.8.0. 2026-11-15 10:53:31 +01:00
locales Cards always centered: no align option. Release 0.5.0. 2026-11-07 17:12:34 +00:00
routes Initial commit 2026-08-21 14:44:20 +02:00
scripts Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
vendor Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
.env.example Migrate to new owner 2026-10-02 13:17:59 +02:00
.gitignore Initial commit 2026-08-21 14:44:20 +02:00
block_render.test.ts Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
block_render.ts Cards always centered: no align option. Release 0.5.0. 2026-11-07 17:12:34 +00:00
compose.dev.yml Migrate to new owner 2026-10-02 13:17:59 +02:00
embed_asset_patterns.ts Initial commit 2026-08-21 14:44:20 +02:00
glue.js Initial commit 2026-08-21 14:44:20 +02:00
LICENSE.md Name Oliver Maklott (Belowtoxic e.U.) as the FSL licensor. 2026-10-17 11:13:17 +02:00
limedoc.project.json The embed-options handler declares its path form (role and title). Release 0.8.0. 2026-11-15 10:53:31 +01:00
mermaid.plugin.json The embed-options handler declares its path form (role and title). Release 0.8.0. 2026-11-15 10:53:31 +01:00
mermaid.ts Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
mermaid_block_editor.tsx Initial commit 2026-08-21 14:44:20 +02:00
mermaid_capabilities.ts Toolbar tool can embed an existing diagram. Release 0.4.3. 2026-11-03 01:14:39 +01:00
mermaid_client.ts Initial commit 2026-08-21 14:44:20 +02:00
mermaid_client_adapter.ts Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
mermaid_directive.test.ts Cards always centered: no align option. Release 0.5.0. 2026-11-07 17:12:34 +00:00
mermaid_directive.ts Cards always centered: no align option. Release 0.5.0. 2026-11-07 17:12:34 +00:00
mermaid_editor_modal.tsx Ship own translations (locales/en,de) via pluginT. Release 0.3.0. 2026-10-24 23:23:01 +02:00
mermaid_editor_tool.test.ts Cards always centered: no align option. Release 0.5.0. 2026-11-07 17:12:34 +00:00
mermaid_editor_tool.tsx The embed-options handler declares its path form (role and title). Release 0.8.0. 2026-11-15 10:53:31 +01:00
mermaid_embed.test.ts Cards always centered: no align option. Release 0.5.0. 2026-11-07 17:12:34 +00:00
mermaid_embed_options.test.ts The embed-options handler declares its path form (role and title). Release 0.8.0. 2026-11-15 10:53:31 +01:00
mermaid_embed_options.ts The embed-options handler declares its path form (role and title). Release 0.8.0. 2026-11-15 10:53:31 +01:00
mermaid_export.ts Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
mermaid_init_config.ts Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
mermaid_open_editor.tsx Ship own translations (locales/en,de) via pluginT. Release 0.3.0. 2026-10-24 23:23:01 +02:00
mermaid_poll_hydrator.test.ts Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
mermaid_poll_hydrator.tsx Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
mermaid_preview_poll.ts Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
mermaid_render_constants.test.ts Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
mermaid_render_constants.ts Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
mermaid_render_marker.test.ts Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
mermaid_save_toast.ts Ship own translations (locales/en,de) via pluginT. Release 0.3.0. 2026-10-24 23:23:01 +02:00
mermaid_tool_dialog.css Toolbar tool can embed an existing diagram. Release 0.4.3. 2026-11-03 01:14:39 +01:00
mermaid_tool_dialog.tsx Cards always centered: no align option. Release 0.5.0. 2026-11-07 17:12:34 +00:00
normalize_svg.test.ts Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
normalize_svg.ts Preview polling stops when nothing waits and reloads only pending images; one render in flight per diagram; inline SVG normalization fails closed. Release 0.7.0. 2026-11-15 00:05:41 +01:00
README.md Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00
source-diagram-editor.css Initial commit 2026-08-21 14:44:20 +02:00
vendor.lock.json Mermaid 12.3.0: ELK layout and neo look by default. Release 0.6.0. 2026-11-10 12:19:57 +01:00

Mermaid Diagrams

Embed and edit Mermaid diagrams in documents.

Diagram style

Mermaid 12.3.0 (vendor/mermaid.min.js, pinned with its SHA-256 in vendor.lock.json). Diagrams render with the neo look, the redux-color theme in light mode and redux-dark-color in dark mode, and Mermaid's default layout, which is ELK since Mermaid 12. Editor preview and the stored light/dark SVGs use the same settings.

A diagram that should keep the older look sets it in its front matter, which takes precedence over the plugin's settings:

---
config:
  layout: dagre
  look: classic
---
flowchart TD
  A --> B

theme can be set the same way (for example theme: default); a fixed theme is then used in both light and dark mode. Diagrams rendered before the upgrade keep their cached SVGs until they are saved again or their entry in the render cache (data/cache/) is removed; a missing entry is re-rendered on request.

Requirements

  • Docker (or Podman with DOCKER_CMD=podman)
  • That's it — everything else runs inside containers.

Quick start

# 1. Pull the dev image and set up .env
./ldcmd setup

# 2. Start the dev environment (app + Redis)
./ldcmd up

# 3. Open http://localhost:5173 in your browser

# 4. Edit plugin sources — HMR applies automatically
# 5. Run tests
./ldcmd test

# 6. Check types and import boundaries
./ldcmd check

Directory layout

mermaid.plugin.json   # Plugin manifest
mermaid.ts            # Server entry (defineLimedocPlugin)
mermaid_editor_tool.tsx  # Browser client (builds to client/*.js)
client/              # Pre-built browser bundles (committed)
limedoc.project.json # Store metadata (package download URLs)
compose.dev.yml      # Dev compose (uses the published limedoc-dev image)
ldcmd                # Bridge script — the only thing you run on your host
.env.example         # Env var template — copy to .env and fill in OIDC values

ldcmd commands

Command What it does
./ldcmd setup Pull limedoc-dev image, copy .env.example → .env
./ldcmd up Start dev environment
./ldcmd down Stop dev environment
./ldcmd logs [service] Follow container logs
./ldcmd sh [service] Open shell in container (default: app-dev)
./ldcmd test Run plugin tests
./ldcmd fmt Format sources
./ldcmd lint Lint sources
./ldcmd check Type-check + import boundary check
./ldcmd pack Build zip + sha256 (CI also publishes sig.json)
./ldcmd publish Pack and upload (needs .forgejo.env / PACKAGE_TOKEN)
./ldcmd plugin install <id> Install a plugin dependency into the running env
./ldcmd plugin ls List installed plugins

Building client bundles

# Inside the container (run after editing .tsx files)
./ldcmd sh
deno task plugin:build -- /limedoc/plugins/mermaid.plugin

Or directly:

./ldcmd check  # runs build as part of the check

Packing and publishing

# Build the installable zip + sha256 sidecar (local)
./ldcmd pack

# Publish (needs .forgejo.env with PACKAGE_TOKEN, PACKAGE_OWNER)
./ldcmd publish

CI (Forgejo Actions, .forgejo/workflows/publish.yml) on push to main publishes zip + sha256 + sig.json to Packages and Releases. Pack CI signs the content hash with OpenBao Transit (Forgejo Actions OIDC). Actions secret PACKAGE_TOKEN only — PACKAGE_OWNER is in the workflow env.

Developing with plugin dependencies

Your plugin may depend on another plugin at runtime. Three ways to include it:

1. Install via ldcmd (easiest, needs the app running)

./ldcmd up
./ldcmd plugin install media   # fetches from PACKAGE_STORE_URL in .env

Set PACKAGE_STORE_URL in .env to point at the Forgejo package registry:

PACKAGE_STORE_URL=https://git.belowtoxic.cloud/api/packages/limedoc-plugins

2. Local bind-mount (no running app needed)

Download the pack zip, unzip it next to this directory, then add a volume to compose.dev.yml:

app-dev:
    volumes:
        - .:/limedoc/plugins/mermaid.plugin
        # Add the dependency:
        - ../other-plugin.plugin:/limedoc/plugins/other.plugin

Then ./ldcmd up — the app loads all *.plugin directories in plugins/.

3. Multi-repo development (two plugins at once)

Check out the other plugin repo next to this one:

cd ..
git clone git@git.belowtoxic.cloud:limedoc-plugins/other.git other.plugin

Then add it as a bind-mount in compose.dev.yml as shown above. Both plugins are mounted into the same app instance. No special ldcmd support required — the app discovers every *.plugin directory at startup.

Startup order: The app loads plugins alphabetically. If your plugin requires another, the dependency must be present on disk for the load plan to resolve. The compose depends_on in the sidecar template ensures the worker sidecar is healthy before the app starts, but for plugin-to-plugin dependencies no extra compose configuration is needed.

CI / CD

Push to main → Forgejo Actions runs .forgejo/workflows/publish.yml:

  1. Tests pass inside the limedoc-dev container
  2. Client bundles built; boundary check passes
  3. plugin:pack produces mermaid-{version}.zip + .sha256
  4. OpenBao signs the content hash → mermaid-{version}.sig.json
  5. Zip, sha256, and sig.json uploaded to the generic package registry (store)
  6. Same artifacts attached to a Forgejo Release v{version} (operators)

The app installs plugins from the generic package registry at PACKAGE_STORE_URL.

Using Podman instead of Docker

# In .env (or export before running):
DOCKER_CMD=podman
./ldcmd up

ldcmd detects podman compose automatically.

License

This pack is source-available under the Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2). Copyright 2026 Oliver Maklott (Belowtoxic e.U.).

You may use, modify, and redistribute it for any purpose other than a Competing Use. Two years after a version is made available, that version is also licensed under the Apache License 2.0. Third-party files under vendor/ keep the license shipped with those files.