hop export

hop export writes the diagram of a pipeline or a workflow to a file, in SVG or Mermaid format. It exports one file, or every pipeline and workflow in a folder.

It uses the same exporters as File > Export diagram in Hop Gui, so you can create the diagrams from a script or a build. The installation also has hop-export.sh and hop-export.bat, which run the same command.

bash
# One file
hop export -f pipelines/load-orders.hpl -o diagrams/load-orders.svg

# One file as Mermaid
hop export -f workflows/main.hwf --format mermaid -o diagrams/main.mmd

# Generate positions for an SVG diagram
hop export -f pipelines/load-orders.hpl -o diagrams/load-orders.svg --layout-policy ALWAYS --layout-algorithm LAYERED


# Every pipeline and workflow in a folder and its subfolders
hop export -s /path/to/project -t /path/to/diagrams --recursive

# The formats this installation can write
hop export --list-exporters

Options

Option Description

-f, --file <file>

The pipeline (.hpl) or workflow (.hwf) to export.

-o, --output-file <file>

The file to write, for -f. By default, the name of the exported file with the extension of the format (.svg or .mmd), in the same folder.

--format <format>

svg or mermaid, in upper or lower case, or another format that an exporter in your installation writes (see --list-exporters). Without it, the extension of the -o file picks the exporter that writes that extension: .mmd is written as Mermaid, and .svg as SVG. Without --format and -o, or with an -o file without an extension, the format is SVG. When no exporter in your installation writes the format, for example pdf or an -o file that ends in .pdf or .png, hop export fails with the formats it does have and writes nothing.

-s, --source-folder <folder>

The folder to export every pipeline and workflow from.

-t, --target-folder <folder>

The folder to write the diagrams to, for -s. Required with -s. See Exporting a folder.

-r, --recursive

With -s, also export the subfolders.

-m, --magnification <factor>

Scale an SVG diagram, for example 2 for twice the size. The default is 1.0. Mermaid diagrams are not scaled.

--layout-policy <policy>

Automatic layout for SVG: NONE (default), ALWAYS or ON_MISSING. See Automatic layout.

--layout-algorithm <algorithm>

LAYERED (default) or GRID. Ignored when the layout policy is NONE.

-in, --include-notes

Notes are included by default. Use -in=false to leave them out of the diagram. Giving -in without a value also leaves them out.

--list-exporters

List the exporters in this installation, with their format and file extension.

-j, --project <name>

Enable a project first, so that variables such as ${PROJECT_HOME} can be used in the file names.

-e, --environment <name>

Enable an environment, and its project, first.

The project options are the same as for hop run:

bash
hop export -j my-project -f '${PROJECT_HOME}/pipelines/load-orders.hpl' -o /tmp/load-orders.svg

Run hop export --help for the full list, which also has -pl, --environments and the other options of the hop command.

Formats

Hop has SVG and Mermaid exporters for both pipelines and workflows. Plugins can add more; --list-exporters shows what your installation has.

bash
$ ./hop export --list-exporters
Available Diagram Exporters (4):
  ID: pipeline-mermaid
    Name: Pipeline Mermaid Exporter
    Format: MERMAID
    Extension: .mmd
    Description: Exports a pipeline diagram to Mermaid flowchart (.mmd)

  ID: pipeline-svg
    Name: Pipeline SVG Exporter
...
  • SVG draws the diagram as it looks in Hop Gui, with the transform and action icons and the notes.

  • Mermaid writes a text flowchart (.mmd) with a node per transform or action and an arrow per hop. You can keep it next to the project in version control, or paste it into a page that renders Mermaid.

Automatic layout

SVG exports can generate positions instead of relying on the saved diagram coordinates. The same options apply to single-file and batch exports, and are available in File > Export diagram in Hop Gui. Use the uppercase enum codes shown below on the command line.

Policy Behavior

NONE

Keep saved positions; do not generate a layout. This is the default, preserving existing export behavior.

ALWAYS

Generate a layout regardless of saved positions.

ON_MISSING

Lay out the whole graph when any node lacks valid explicit coordinates; otherwise keep saved positions. An explicitly saved (0,0) is not missing.

LAYERED, the default algorithm, arranges nodes in layers following the graph connections. GRID arranges nodes in a grid. Both algorithms are deterministic for the same ordered input and options; changing the input order can change the generated positions. Export uses a detached drawing model when changes are needed and does not change the original pipeline or workflow. SVG layout accounts for measured node labels, decorations, and note sizes including their text and borders. GRID packs included notes after the executable nodes in the same grid. LAYERED repacks included notes in a separate annotation band above the execution graph. Saved note positions do not affect generated layouts, and missing note positions alone do not trigger ON_MISSING. Hops are not routed around obstacles. Font availability can affect measured footprints, so output is not guaranteed to be identical across machines. The algorithm is ignored with policy NONE, and the GUI disables its selector until another policy is selected. Mermaid uses its own renderer for layout and does not use these options.

Exporting a folder

With -s, hop export exports every .hpl and .hwf file in the folder, and with -r in its subfolders too. Each diagram is written under -t with the same relative path, for example pipelines/load-orders.hpl becomes pipelines/load-orders.svg.

  • -t must be an existing folder. With -r, its subfolders must exist as well.

  • The export stops at the first file it can’t export, for example a diagram whose folder is missing under -t, or a file that is not valid XML. The diagrams written before it stay.

  • A file that no exporter for the format supports is skipped and logged, for example a workflow when only pipelines have an exporter for that format. The other files are still exported.

  • A pipeline and a workflow with the same name in the same folder are written to the same file, so only the last one is kept.

At the end, the command logs how many diagrams it exported and how many it skipped.

Exit codes

hop export ends with 0 when the export is done, and with 1 when it fails, for example when the source folder doesn’t exist, no exporter writes the format, or a diagram can’t be written.

The hop-export.sh and hop-export.bat scripts end with other codes:

Code Meaning

0

The export is done.

1

The help was shown, with --help.

2

The export failed, for example when the source folder doesn’t exist or a file is not a valid pipeline or workflow.

9

An option is not valid.