Skip to content

Create

Create a new Mermaid diagram in your Merfolk account.

Usage

merfolk diagrams create [flags]

Flags

Flag Description
--title <title> Title for the new diagram
--content <mermaid> Initial Mermaid source
--json Output result as JSON

Examples

# Create an empty diagram
merfolk diagrams create --title "My diagram"

# Create with initial content
merfolk diagrams create --title "Auth flow" --content "sequenceDiagram\n  User->>App: Login"

# Pipe content from a file
cat auth.mmd | merfolk diagrams create --title "Auth flow"

# Create and capture the ID
ID=$(merfolk diagrams create --title "My diagram" --json | jq -r '.id')

Output

Default output prints the new diagram ID and a link to view it:

Created diagram abc123
View at: https://app.merfolk.io/d/abc123

With --json:

{
  "id": "abc123",
  "title": "My diagram",
  "url": "https://app.merfolk.io/d/abc123",
  "createdAt": "2024-01-15T10:30:00Z"
}

Exit codes

Code Meaning
0 Diagram created
2 Not authenticated
1 Creation failed
Navigation

Type to search…

↑↓ navigate↵ selectEsc close