Reputation: 11
What is the best and simplest way to parse *.rst file and get all code from code-block
s to execute (or compile) this code? This may be useful to test some instructions in .rst format and use them for CI purposes.
Thanks!
Upvotes: 1
Views: 1301
Reputation: 31088
It's actually easier to put the code examples into separate files and include them into the .rst
file:
This is a code block from a file:
.. include:: file.php
:code: php
See the include directive's documentation.
Upvotes: 2