{
  "name": "Markdown to PDF (PaperType)",
  "nodes": [
    {
      "parameters": {},
      "name": "When clicking 'Execute workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {"id": "a1", "name": "title", "value": "Weekly report", "type": "string"},
            {"id": "a2", "name": "markdown", "value": "# Weekly report\n\n## Summary\n\nThree releases shipped. No incidents.\n\n## Numbers\n\n| Metric | Value |\n|---|---|\n| Deploys | 3 |\n| Open bugs | 7 |\n\n## Next week\n\n- Finish the billing migration\n- Rotate the signing keys", "type": "string"}
          ]
        },
        "options": {}
      },
      "name": "Document",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [220, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://papertype.dev/v1/pdf",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ markdown: $json.markdown, title: $json.title, theme: 'clean', toc: true, page_numbers: true }) }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "data"
            }
          }
        }
      },
      "name": "Render PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [440, 0],
      "credentials": {
        "httpHeaderAuth": {"name": "PaperType API"}
      }
    }
  ],
  "connections": {
    "When clicking 'Execute workflow'": {"main": [[{"node": "Document", "type": "main", "index": 0}]]},
    "Document": {"main": [[{"node": "Render PDF", "type": "main", "index": 0}]]}
  }
}
