Skip to content

CLI reference

nf-metro ships four commands - render, convert, validate, and info. This page documents every option. Most render flags also have a %%metro directive twin; an explicitly-passed flag overrides the directive.

Render a Mermaid metro map definition to SVG or interactive HTML.

Terminal window
nf-metro render [OPTIONS] INPUT_FILE...

Accepts one or more INPUT_FILEs. With more than one, all render within the same process and each write to their own sibling <input>.<format>; every file is attempted even if an earlier one fails, and the command exits non-zero if any failed.

Every layout/render option below also has a %%metro directive twin; an explicitly-passed flag overrides the directive (see the precedence table in the guide).

OptionDefaultDescription
-o, --output PATH<input>.<format>Output file path (only valid with a single INPUT_FILE)
--format [svg|html]svgOutput format: svg or interactive html
--theme [nfcore|light]from style:, else nfcoreVisual theme
--debug / --no-debugoffShow debug overlay
--from-nextflowoffConvert Nextflow -with-dag input before rendering
--logo PATHnoneLogo image path (must exist; errors on a bad path, same as %%metro logo:)
--title TEXTnonePipeline title
--legend TEXTautoLegend+logo position (keyword, keyword | canvas, keyword | dx,dy, or x,y)
--line-spread [bundle|centered|rails]bundleHow shared lines relate vertically
--x-spacing FLOATautoHorizontal spacing between layers
--y-spacing FLOATautoVertical spacing between tracks
--section-x-gap FLOAT50Horizontal gap between sections
--section-y-gap FLOAT50Vertical gap between sections
--fold-threshold INTEGERauto (15)Max station-columns per row before folding
--diamond-style [straight|symmetric]straightFork-join layout
--line-order [definition|span]definitionLine ordering for track assignment
--center-ports / --no-center-portsoffCentre inter-section ports on the shorter section
--compact-offsets / --no-compact-offsetsoffSize stations only for the lines passing through
--label-angle FLOATtheme defaultStation-label angle in degrees
--font-scale FLOAT1.0Scale text and label-driven layout spacing
--logo-scale FLOAT1.0Scale the logo within the legend
--legend-min-height FLOAT0Minimum legend content height in pixels
--legend-logo-gap FLOATautoGap between logo and legend entries
--width INTEGERautoOutput width in pixels
--height INTEGERautoOutput height in pixels
--animate / --no-animateoffAdd animated balls traveling along lines

Flags for producing an SVG to embed in another page or application. The Embedding guide explains when to use each.

OptionDefaultDescription
--responsive / --no-responsiveoffEmit viewBox only (no fixed width/height) for CSS-scalable embedding
--embed-font / --no-embed-fontoffInline Inter as a base64 @font-face so the SVG renders identically anywhere
--text-to-paths / --no-text-to-pathsoffConvert text to vector paths (no font dependency; loses selectable text)
--bare / --no-bareoffOmit the title and outer padding so the canvas hugs the content (keeps the watermark)
--svg-class-prefix TEXTnonePrefix every SVG presentation class so multiple maps on one page don’t collide
--no-dark-mode-cssoffSuppress the prefers-color-scheme: dark block when the host manages its own theme
--no-chrome-cssoffBake concrete chrome colors instead of --nfm-* var() (needed for raster export, e.g. cairosvg)

--format html produces a self-contained .html file with the SVG inlined plus a small JS/CSS layer (no external dependencies, no network):

Terminal window
nf-metro render pipeline.mmd --format html -o pipeline.html

The page supports drag-to-pan, scroll-to-zoom, station hover tooltips, and a clickable line legend. Clicking a line isolates it: stations and sections not carrying that line are hidden and the view zooms to the bounding box of what remains. Click again, hit Esc, or use the Reset button to restore.

The Embed… button opens a panel with copyable inline-HTML, iframe, and static-SVG snippets. The Embedding guide explains when to reach for each, plus responsive sizing, font portability, host theming, and progress overlays.

Pass --validate to check the drawn SVG after rendering and fail (non-zero exit) if a route is drawn through a station’s label or marker, or two distinct lines collapse into one stroke where they should run parallel. This reads the geometry as it ends up on the page (after the per-line offsets and label shifts the layout applies), catching defects the pre-render checks cannot see:

Terminal window
nf-metro render pipeline.mmd -o pipeline.svg --validate

To run the same geometry checks on an already-rendered SVG, use nf-metro validate-svg --geometry.

Convert a Nextflow -with-dag mermaid file to nf-metro format.

Terminal window
nf-metro convert [OPTIONS] INPUT_FILE
OptionDefaultDescription
-o, --output PATHstdoutOutput .mmd file path
--title TEXTautoPipeline title

See Importing from Nextflow for details and examples.

Check a .mmd file for errors without producing output.

Terminal window
nf-metro validate INPUT_FILE

Print a summary of the parsed map: sections, lines, stations, and edges.

Terminal window
nf-metro info INPUT_FILE