Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Docs fix broken list code example #5719

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MeelahMe
Copy link

Closes #

Describe your proposed changes here.

@MeelahMe MeelahMe changed the title Docs fix broken list code example (not fully done) WIP: Docs fix broken list code example Dec 20, 2024
@MeelahMe MeelahMe marked this pull request as draft December 20, 2024 20:26
Comment on lines -18 to -23
<!-- Import for tests and hide from users.
```python
import os
```
-->
<!--pytest-codeblocks:cont-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just remove the comments and commented lines, it should fix the list page display--that's the quick fix.

As a more strategic fix, I like your idea, but...

  • it would also require changing the section (_index) page template to support it.
  • the page that includes the example would need to hide it from displaying

I'm fine with a quick fix. For the "strategic" fix, my preference would probably be to change the parsing/rendering of the existing list_code_example frontmatter field to support the test setup comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...just thinking out loud... a better "fix" might be to have the test runner inject

import os

for each example before running it - that eliminates the need for alot of pytest comments in the pages.

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.

2 participants