Skip to content

Suggestion: Improve code snippet readability in documentation for easier copy-paste #509

Open

Description

@prdai

Hi,

I wanted to suggest an improvement to the documentation format gently. While the .. testcode:: blocks are great for testing examples, they present two minor friction points for new users:

  1. Readability
    The indented code blocks without syntax highlighting make it harder to scan/understand examples quickly

  2. Copy-Paste Experience
    When copying code directly from GitHub's rendered documentation:

    • The extra indentation requires manual adjustment
    • Hidden .. testoutput:: blocks can accidentally get copied

Would you consider either:

  • Adding triple-backtick (```python) code fences alongside testcode blocks
  • Including a "Copy to Clipboard" button via Sphinx extensions (like this one)
  • Adjusting indentation levels for better copy-paste ability

This would make it even easier for folks to:

  1. Quickly try examples from the docs
  2. Experiment with Tenacity's awesome features
  3. Adopt best practices faster

I'm happy to help submit a PR if this aligns with the project's direction! Just let me know what approach you'd prefer.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions