Aller au contenu principal

Documentation Viewer (viewer)

The viewer command starts a local HTTP server that renders the Markdown documentation generated by generate in a browser. It provides a convenient way to preview your model documentation without publishing it.

opcua-modeler viewer --input my-model.documentation.md

Basic usage

Generate your model first, then open the viewer:

# Step 1 — generate the model and its documentation
opcua-modeler generate -i model.yaml

# Step 2 — view the generated documentation in a browser
opcua-modeler viewer --input model.documentation.md

The viewer opens your default browser automatically and serves the documentation at http://localhost:3000 (or the next available port).


Live preview with watch mode

Combine viewer with --watch on the generate command for a fully live authoring loop:

# Terminal 1 — keep rebuilding on every YAML change
opcua-modeler generate -i model.yaml --watch

# Terminal 2 — serve the docs
opcua-modeler viewer --input model.documentation.md

The viewer picks up the regenerated Markdown automatically when you reload the browser.


PDF export

New in v2.1.0

Generate a PDF of the documentation directly from the viewer using headless Chrome:

opcua-modeler viewer --input model.documentation.md --pdf

The PDF is saved alongside the Markdown file as model.documentation.pdf.


Options

FlagShortDefaultDescription
--input-iInput .documentation.md file (required)
--port-p3000HTTP server port
--pdfoffExport to PDF (headless Chrome)