1

I'm using a Sphinx extension (this one) which generates some ReST markup dynamically. Sphinx uses that ReST to generate html documentation.

I want to examine and run doctests on the generated ReST markup. Normally I use

sphinx-build -E -b html docs dist/docs

to generate the html output, but there is no rst "builder" equivalent to the html one.

How can I examine the generated ReST markup?

Hatshepsut
  • 5,962
  • 8
  • 44
  • 80

1 Answers1

2

Use the Sphinx extension sphinx.ext.doctest, following its syntax and markup.

Then run make doctest to run the doctests.

Update

In response to your comments and taking the suggestion from @mzjn, it sounds like you want to generate an intermediate set of documentation that is in reStructuredText. The Sphinx extension restbuilder might be want you seek.

From that point, make doctest might be want you want.

Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • I'm using [docshtest](https://github.com/vaab/docshtest/) not only vanilla `sphinx.ext.doctest` because I want to test shell demos. I've found a workaround, but for future reference, Is it possible to examine the generated rst from an extension? – Hatshepsut Jul 22 '19 at 00:01
  • What do you mean "examine"? When I examine a file, I open it in an editor and look at it, and I assume you can do that. Maybe you mean something else? – Steve Piercy Jul 22 '19 at 00:03
  • Opening it in a file is what I mean. The link in my question shows that extension generates some rst, but I don't think it's ever written to a file, so I don't know how to look at it in my editor (or run `docshtest` on it). – Hatshepsut Jul 22 '19 at 00:04