• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JBZoo / Mermaid-PHP / 30002095152
92%

Build:
DEFAULT BRANCH: master
Ran 23 Jul 2026 11:10AM UTC
Jobs 6
Files 30
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Jul 2026 11:09AM UTC coverage: 90.404% (+0.6%) from 89.767%
30002095152

push

github

web-flow
feat: clickable node links and per-link styles (#32)

## Summary

Adds two Mermaid flowchart features, both fully opt-in and backward
compatible:

1. **Clickable nodes** — attach a hyperlink to a node, rendered as a
Mermaid `click` directive with optional tooltip and target.
2. **Per-link styles** — give an individual link its own CSS, rendered
as `linkStyle <index> ...;` with the index resolved automatically.

Reimplements, on the current 8.x codebase, the features originally
proposed by @biscofil in #7 (which was merged for authorship; its 2021
code was incompatible with the rewritten codebase).

## API additions (all additive — no breaking changes)

**`Node`**
- Constructor gains a trailing `?string $url = null`.
- `setUrl()/getUrl()`, `setTooltip()/getTooltip()`,
`setTarget()/getTarget()`.
- Target constants: `Node::TARGET_BLANK`, `TARGET_SELF`,
`TARGET_PARENT`, `TARGET_TOP`.
- `getClickStatement(): ?string`.

**`Link`**
- Constructor gains a trailing `?string $css = null`.
- `setCss()/getCss()`.

**`Graph`**
- `addLinkByIds()` gains a trailing `?string $css = null`.
- `render()` now emits a global `click` / `linkStyle` section (only when
the features are used).

```php
$graph = (new Graph())
    ->addNode($a = (new Node('A', 'Docs'))->setUrl('https://github.com/JBZoo/Mermaid-PHP')->setTarget(Node::TARGET_BLANK))
    ->addNode($b = new Node('B'))
    ->addLink((new Link($a, $b))->setCss('stroke:blue,stroke-width:4px'));
// ...
// linkStyle 0 stroke:blue,stroke-width:4px;
// click A "https://github.com/JBZoo/Mermaid-PHP" _blank
```

## Backward compatibility

- `Link::setStyle(int)` and all existing constructor signatures,
constants and `__toString()` behaviour are untouched — new state is
added via new methods and trailing optional parameters only.
- A graph that uses no url/css renders byte-for-byte identically to
before; every pre-existing test assertion passes unmodified (they are
the behavioural contract), plus an explicit
`testBackwardCompatO... (continued)

58 of 58 new or added lines in 3 files covered. (100.0%)

537 of 594 relevant lines covered (90.4%)

92.82 hits per line

Jobs
ID Job ID Ran Files Coverage
1 30002095152.1 23 Jul 2026 11:10AM UTC 30
90.4
GitHub Action Run
2 30002095152.2 23 Jul 2026 11:10AM UTC 30
90.4
GitHub Action Run
3 30002095152.3 23 Jul 2026 11:10AM UTC 30
90.4
GitHub Action Run
4 30002095152.4 23 Jul 2026 11:11AM UTC 30
90.4
GitHub Action Run
5 30002095152.5 23 Jul 2026 11:11AM UTC 30
90.4
GitHub Action Run
6 30002095152.6 23 Jul 2026 11:11AM UTC 30
90.4
GitHub Action Run
Source Files on build 30002095152
  • Tree
  • List 30
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 275406b4 on github
  • Prev Build on master (#29993003552)
  • Next Build on master (#30072388792)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc