Skip to content

Commit

Permalink
feature symfony#15102 [Workflow] Add info about MermaidDumper (eFrane)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Workflow] Add info about MermaidDumper

<!--

If your pull request fixes a BUG, use the oldest maintained branch that contains
the bug (see https://symfony.com/releases for the list of maintained branches).

If your pull request documents a NEW FEATURE, use the same Symfony branch where
the feature was introduced (and `5.x` for features of unreleased versions).

-->

This updates the documentation for symfony/symfony#40171.

Commits
-------

b7340c7 [Workflow] Add info about MermaidDumper
  • Loading branch information
wouterj committed Apr 13, 2021
2 parents 4f0a1f0 + b7340c7 commit 87dbda0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Binary file added _images/components/workflow/blogpost_mermaid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 19 additions & 1 deletion workflow/dumping-workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ them as SVG or PNG images. First, install any of these free and open source
applications needed to generate the images:

* `Graphviz`_, provides the ``dot`` command;
* `Mermaid CLI`_, provides the ``mmdc`` command;
* `PlantUML`_, provides the ``plantuml.jar`` file (which requires Java).

.. versionadded:: 5.3

The ``mermaid`` dump format was introduced in Symfony 5.3.

If you are defining the workflow inside a Symfony application, run this command
to dump it as an image:

Expand All @@ -28,10 +33,17 @@ to dump it as an image:
# highlight 'place1' and 'place2' in the dumped workflow
$ php bin/console workflow:dump workflow-name place1 place2 | dot -Tsvg -o graph.svg
# using Mermaid.js CLI
$ php bin/console workflow:dump workflow_name --dump-format=mermaid | mmdc -o graph.svg
The DOT image will look like this:

.. image:: /_images/components/workflow/blogpost.png

The Mermaid image will look like this:

.. image:: /_images/components/workflow/blogpost_mermaid.png

The PlantUML image will look like this:

.. image:: /_images/components/workflow/blogpost_puml.png
Expand Down Expand Up @@ -63,7 +75,7 @@ You can use ``metadata`` with the following keys to style the workflow:

* ``bg_color``: a color;
* ``description``: a string that describes the state.

* for transitions:

* ``label``: a string that replaces the name of the transition;
Expand All @@ -76,6 +88,11 @@ Colors can be defined as:
* a color name from `PlantUML's color list`_;
* an hexadecimal color (both ``#AABBCC`` and ``#ABC`` formats are supported).

.. note::

The Mermaid dumper does not support coloring the arrow heads
with ``arrow_color`` as there is no support in Mermaid for doing so.

Below is the configuration for the pull request state machine with styling added.

.. configuration-block::
Expand Down Expand Up @@ -310,5 +327,6 @@ The PlantUML image will look like this:
.. image:: /_images/components/workflow/pull_request_puml_styled.png

.. _`Graphviz`: https://www.graphviz.org
.. _`Mermaid CLI`: https://github.com/mermaid-js/mermaid-cli
.. _`PlantUML`: https://plantuml.com/
.. _`PlantUML's color list`: https://plantuml.com/color

0 comments on commit 87dbda0

Please sign in to comment.