xref: /plugin/bpmnio/README.md (revision 738a44ff661500d783f23960888bd3ae2818f44c)
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 — falls back to the global plugin setting `lint` (configurable in the
47  DokuWiki admin under _Configuration Settings → Plugins → bpmnio_). The
48  shipped default is `off`, which applies to both rendered pages and the
49  editor.
50
51## Development
52
53### Prerequisites
54
55- PHP
56- [Composer](https://getcomposer.org/)
57- Node.js and npm
58
59### Setup
60
61```bash
62# Install PHP dev dependencies (phpcs, phpstan)
63composer install
64
65# Install JS/CSS dev dependencies and vendor build packages
66npm install
67```
68
69### Linting
70
71```bash
72# PHP code style
73composer cs
74
75# PHP static analysis
76composer stan
77
78# JavaScript lint
79npm run lint:js
80
81# LESS/CSS lint
82npm run lint:css
83
84# All JS + CSS lints
85npm run lint
86```
87
88### Testing
89
90Tests run within the DokuWiki test framework. Clone the plugin into a DokuWiki
91installation's `lib/plugins/bpmnio/` directory, then run:
92
93```bash
94cd /path/to/dokuwiki
95php vendor/bin/phpunit --group plugin_bpmnio
96```
97
98### Customising the BPMN linter
99
100The lint rules are defined in [`.bpmnlintrc`](.bpmnlintrc) at the repo root and
101are compiled into the committed viewer/modeler bundles at build time (bpmnlint
102cannot resolve rules in the browser). The default config extends
103[`bpmnlint:recommended`](https://github.com/bpmn-io/bpmnlint#built-in-rules).
104After editing `.bpmnlintrc`, rebuild the bundles:
105
106```bash
107npm run build:vendor   # or ./update-vendor.sh
108```
109
110To add project-specific rules, create a local
111[bpmnlint plugin](https://github.com/bpmn-io/bpmnlint#plugins) (a
112`bpmnlint-plugin-<name>` package exporting `rules` and a `recommended` config),
113add it to `package.json` (e.g. as a `file:` dependency), reference it from
114`.bpmnlintrc` via `plugin:<name>/recommended`, and rebuild. The packing step
115inlines the resolved rules so no resolver is needed at runtime.
116
117### Updating vendor libraries
118
119The committed `vendor/` bundles are generated locally from the npm packages
120declared in [package.json](package.json). To update them:
121
122```bash
123# Change the pinned bpmn-js / dmn-js versions in package.json when needed
124npm install
125
126# Rebuild the committed vendor bundles and copied assets
127npm run build:vendor
128
129# Or use the compatibility wrapper
130./update-vendor.sh
131```
132
133The build step emits the production browser bundles into `vendor/`, copies the
134required LESS assets from `node_modules`, and refreshes the public `font/`
135directory used by DokuWiki.
136