xref: /plugin/bpmnio/README.md (revision c88bd154bd573c8ceefeb9b009eba97536aec54c)
1# dokuwiki-plugin-bpmnio
2
3Renders using the bpmn.io js libraries within dokuwiki:
4
5* BPMN v2.0 diagrams
6* DMN v1.3 decision requirement diagrams, decision tables and literal expressions
7
8Refer to this page for details: <https://www.dokuwiki.org/plugin:bpmnio>
9
10## Usage
11
12Embed a diagram by wrapping inline XML (or referencing a media file) in a
13`<bpmnio>` block:
14
15```
16<bpmnio type="bpmn">
17...BPMN 2.0 XML...
18</bpmnio>
19
20<bpmnio type="bpmn" src="wiki:diagrams:zoning-map-amendment.bpmn" zoom="0.8" />
21```
22
23### Attributes
24
25| Attribute | Values | Description |
26| --------- | ------ | ----------- |
27| `type` | `bpmn` (default), `dmn` | Diagram kind. |
28| `src` | media id | Render a stored media file instead of inline XML. |
29| `zoom` | positive number | Scale factor applied to the rendered diagram. |
30| `lint` | `on`, `off`, `inactive` | Per-diagram [bpmnlint](https://github.com/bpmn-io/bpmnlint) behaviour (BPMN only). |
31
32### Linting BPMN diagrams
33
34BPMN diagrams ship with an embedded [bpmnlint](https://github.com/bpmn-io/bpmnlint)
35linter via [bpmn-js-bpmnlint](https://github.com/bpmn-io/bpmn-js-bpmnlint). A
36toggle button appears in the corner of the canvas; clicking it overlays
37clickable error/warning badges on the offending elements, each opening the list
38of issues for that element. This works on rendered wiki pages (read-only viewer)
39as well as in the editor.
40
41The `lint` attribute controls the default state per diagram:
42
43* `lint="on"` — overlays are shown immediately.
44* `lint="inactive"` — the toggle button is present but overlays start hidden.
45* `lint="off"` — the linter is not loaded for that diagram (no button).
46* omitted — viewer diagrams default to the button being present but inactive;
47  the editor defaults to active so authors get immediate feedback.
48
49## Development
50
51### Prerequisites
52
53* PHP 8.1+
54* [Composer](https://getcomposer.org/)
55* Node.js 20+ and npm
56
57### Setup
58
59```bash
60# Install PHP dev dependencies (phpcs, phpstan)
61composer install
62
63# Install JS/CSS dev dependencies and vendor build packages
64npm install
65```
66
67### Linting
68
69```bash
70# PHP code style
71composer cs
72
73# PHP static analysis
74composer stan
75
76# JavaScript lint
77npm run lint:js
78
79# LESS/CSS lint
80npm run lint:css
81
82# All JS + CSS lints
83npm run lint
84```
85
86### Testing
87
88Tests run within the DokuWiki test framework. Clone the plugin into a DokuWiki
89installation's `lib/plugins/bpmnio/` directory, then run:
90
91```bash
92cd /path/to/dokuwiki
93php vendor/bin/phpunit --group plugin_bpmnio
94```
95
96### Customising the BPMN linter
97
98The lint rules are defined in [`.bpmnlintrc`](.bpmnlintrc) at the repo root and
99are compiled into the committed viewer/modeler bundles at build time (bpmnlint
100cannot resolve rules in the browser). The default config extends
101[`bpmnlint:recommended`](https://github.com/bpmn-io/bpmnlint#built-in-rules).
102After editing `.bpmnlintrc`, rebuild the bundles:
103
104```bash
105npm run build:vendor   # or ./update-vendor.sh
106```
107
108To add project-specific rules, create a local
109[bpmnlint plugin](https://github.com/bpmn-io/bpmnlint#plugins) (a
110`bpmnlint-plugin-<name>` package exporting `rules` and a `recommended` config),
111add it to `package.json` (e.g. as a `file:` dependency), reference it from
112`.bpmnlintrc` via `plugin:<name>/recommended`, and rebuild. The packing step
113inlines the resolved rules so no resolver is needed at runtime.
114
115### Updating vendor libraries
116
117The committed `vendor/` bundles are generated locally from the npm packages
118declared in [package.json](package.json). To update them:
119
120```bash
121# Change the pinned bpmn-js / dmn-js versions in package.json when needed
122npm install
123
124# Rebuild the committed vendor bundles and copied assets
125npm run build:vendor
126
127# Or use the compatibility wrapper
128./update-vendor.sh
129```
130
131The build step emits the production browser bundles into `vendor/`, copies the
132required LESS assets from `node_modules`, and refreshes the public `font/`
133directory used by DokuWiki.
134