跳转到主要内容

sphinxcontrib-pyexec

项目描述

# PyExec

![文档状态](https://readthedocs.org/projects/sphinxcontrib-pyexec/badge/?version=latest)[点击查看](http://sphinxcontrib-pyexec.readthedocs.io/en/latest/?badge=latest) ![构建状态](https://travis-ci.org/3ptscience/sphinxcontrib-pyexec.svg?branch=master)[点击查看](https://travis-ci.org/3ptscience/sphinxcontrib-pyexec)


Sphinx 的一个扩展,用于运行 Python 代码并显示输入和
输出 [Sphinx 文档](https://sphinx-doc.cn/).

在 conf.py 中将 `PyExec` 添加到您的扩展列表中。

在 ReStructuredText 文件中,使用 `exec` 环境

```
.. exec:
print 2 + 2
```

以在您的文档中输出 Python 代码及其结果。

```
>> print 2 + 2
4
```

注意,您需要包含 `print` 语句以显示输出。要查看实际效果,请查看 [Properties 文档](http://propertiespy.readthedocs.io/).

基于

- https://github.com/sphinx-doc/sphinx/blob/master/sphinx/directives/code.py
- http://stackoverflow.com/a/18143318/6086999

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码发行版

sphinxcontrib-pyexec-0.0.4.tar.gz (4.3 kB 查看哈希值)

上传时间 源代码

支持