Aller au contenu

Create PDF From Plan

Export a Cursor plan file to a PDF in ~/Downloads on macOS. The bundled renderer strips plan frontmatter, turns the markdown into printable HTML, renders Mermaid diagrams when present, then prints the result with headless Google Chrome.

Workflow

  1. Resolve the source plan path in this order:
  2. Use the explicit path from the user when provided.
  3. Otherwise inspect the active tab and use it only if it is clearly a plan file, for example a path ending in .plan.md or living under .cursor/plans.
  4. Otherwise ask the user which plan to export with AskQuestion instead of guessing.
  5. Validate that the selected source is a markdown plan file. Accept *.plan.md and files under .cursor/plans or ~/.cursor/plans.
  6. Confirm Google Chrome exists at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome. If it does not, stop and report the missing dependency.
  7. Run the bundled script:
bash ".cursor/skills/create-pdf-from-plan/scripts/render_plan_pdf.sh" "<plan-path>" "<optional-output-name>"
  1. Report the final PDF path returned by the script.

Behavior Rules

  • Keep the implementation macOS-specific where needed because the output target is ~/Downloads.
  • Do not leave intermediate HTML files behind. The script handles temp cleanup automatically.
  • Prefer the script output filename when the user gives one. Otherwise let the script derive the PDF name from the plan filename.
  • Mermaid diagrams inside ```mermaid fences are supported. If a Mermaid block cannot be rendered, the export should still succeed and keep the raw block visible instead of failing the whole PDF.

Path Selection Guidance

  • Treat the active tab as authoritative only when its path clearly identifies a plan file.
  • If the active tab is not a plan and the user did not provide a path, ask a focused question with candidate plan files rather than choosing one silently.
  • If multiple plan files are plausible, prefer showing short labels and absolute paths in the question so the user can pick the right one quickly.

Expected Output

  • The script writes the PDF to ~/Downloads/<sanitized-name>.pdf.
  • The script prints the final PDF path on stdout.
  • The final response should mention the generated file path and whether Mermaid blocks were handled normally or fell back to raw code because of a rendering issue.