6

Looking for advice from developers phamiliar with PHP, or Phabricator internals, on how to make Phabricator to have PlantUML (text to UML diagrams) within wiki pages, tasks. So that this UML code snippet in GitHub/GitLab grammar

```plantuml

Bob->Alice : hello

```

would be shown as diagram on rendered wiki page.

sequence diagram generated example

"Call it from PHP" page on https://plantuml.com/demophp.php is 404 - Not Found.

UPDATE Please add answer with any further improvements or suggestions.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
  • 1
    did you look at [tools using plantuml](https://plantuml.com/en/running) to have examples of integration ? Also [PHP API Client Code](https://plantuml.com/fr/code-php) (referenced in https://plantuml.com/fr/sitemap-plugins) – bruno Mar 18 '21 at 08:24
  • Thanks I did, calling a server with https://github.com/jawira/plantuml-encoding shown as example is not intention. We can deploy plantuml.jar to the Phabricator, the issue will be how to intregrate it's (local) usage within Phabricator code. – Paul Verest Mar 18 '21 at 09:48
  • Mediawiki (Wikipedia source, in PHP) has an [extension](https://www.mediawiki.org/wiki/Extension:PlantUML) for PlantUML. Would something like [this code](https://github.com/pjkersten/PlantUML/blob/576f910c1a89b1506bbcb0aa4188a0a76bc9c9cf/PlantUML.body.php#L266) work for you? – JCOC611 Apr 05 '21 at 05:02

1 Answers1

3

The syntax you have used is for syntax highlighting of source code. I think it would be better to define a new remarkup tag for this purpose (by extending PhabricatorRemarkupCustomBlockRule in a custom extension) rather than trying to overload syntax highlighting.

Unfortunately I can't find any examples of extending PhabricatorRemarkupCustomBlockRule, but there are examples of extending PhabricatorRemarkupCustomInlineRule which should be similar, such as here: https://discourse.phabricator-community.org/t/hyperlink-to-external-bug-tracking-system/1415

JSON
  • 4,487
  • 22
  • 26
  • Thank you, that is the start. Yes, it is exactly how to write within markdown to get picture instead of just highlight. See for example GitLab https://docs.gitlab.com/ee/administration/integration/plantuml.html – Paul Verest Mar 26 '21 at 06:03