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

Use sphinx directive to generate output of full examples in the docs #92

Open
janluke opened this issue Sep 7, 2021 · 5 comments
Open
Labels
chore documentation Improvements or additions to documentation low priority

Comments

@janluke
Copy link
Owner

janluke commented Sep 7, 2021

Something like .. click:run:: directive.

https://github.com/pallets/pallets-sphinx-themes/blob/main/src/pallets_sphinx_themes/themes/click/domain.py

@janluke janluke added documentation Improvements or additions to documentation chore labels Sep 7, 2021
@kdeldycke
Copy link
Contributor

kdeldycke commented Jul 27, 2022

I just managed to do it in click-extra. Here is how I did it:

  1. Add Pallets-Sphinx-Themes dependency
  2. Add a little workaround in Sphinx's conf.py
  3. And now you can use both .. click:example:: and .. click:run:: in your docs.

Note that both directives needs to resides in the same {eval-rst} MyST block.

It's kind of hackish but OK to me as it lighten up a bit the burden of documentation maintenance.

@kdeldycke
Copy link
Contributor

For the record, I added a bug report to the sphinx-click project to implement this feature instead of having it embedded within the Pallets-Sphinx-Themes project.

@janluke
Copy link
Owner Author

janluke commented Jul 28, 2022

Thanks for the useful info, @kdeldycke!

@kdeldycke
Copy link
Contributor

I just made something really cool for the upcoming click-extra v3.0.0 release: I managed to have the .. click:run:: directive output ANSI colored shell session in Pygments. It's a little janky but does the job.

@kdeldycke
Copy link
Contributor

FYI, I just streamlined and documented the setup of .. click:example:: and .. click:run:: directives at: https://kdeldycke.github.io/click-extra/sphinx.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore documentation Improvements or additions to documentation low priority
Projects
None yet
Development

No branches or pull requests

2 participants