Skip to content

Conversation

@copilot-developer-agent-robch
Copy link

@copilot-developer-agent-robch copilot-developer-agent-robch bot commented Feb 21, 2025

The --screenshot [FILE] option has been added to the mdx web command to automatically capture a screenshot of each web page after loading. The screenshot file path uses the same template functionality as other outputs like --save-page-output, where:

  • If no file path is specified, the default template "{filePath}/{fileBase}-output.png" is used
  • Template variables like {filePath} and {fileBase} are supported to generate unique filenames
  • Screenshots are taken in headless browser mode by default unless --interactive is used
  • Full page screenshots are captured to include all content, not just the viewport
  • Screenshot paths are included in the markdown output for reference

Example usage:

# Save screenshot with default filename template 
mdx web get https://example.com --screenshot

# Use custom screenshot filename template
mdx web get https://example.com --screenshot "{filePath}/{fileBase}-fullpage.png"

# Screenshot multiple pages, saving content and screenshots
mdx web get https://example.com https://another.com --save-page-output "{filePath}/{fileBase}-content.md" --screenshot "{filePath}/{fileBase}-screenshot.png"

The required changes included:

  • Adding Screenshot property to WebCommand base class
  • Adding screenshot command line option parsing
  • Extending PlaywrightHelpers to support screenshot capture
  • Updating help documentation with new parameter

Fixes #5.

@copilot-developer-agent-robch copilot-developer-agent-robch bot changed the title [WIP] mdx web -- consider adding --screenshot functionality Add --screenshot functionality to mdx web command Feb 21, 2025
@copilot-developer-agent-robch copilot-developer-agent-robch bot marked this pull request as ready for review February 21, 2025 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mdx web -- consider adding --screenshot functionality

1 participant