Sphinx使用

安装Sphinx

pip install sphinx
pip install sphinx_rtd_theme
pip install recommonmark

其中第二个命令是安装主题,第三个命令是添加对md文件的支持

建立目标目录进行初始化

mkdir website
cd website
sphinx-quickstart

此时如果出现错误

sphinx-quickstart: command not found

则换一种安装方式

sudo apt-get install python-sphinx

支持markdown文件更改文档主题

打开source/conf.py,修改主题

html_theme = 'sphinx_rtd_theme'

在15行添加:

import os
import sys
from recommommark.parser import CommomMarkParser
sys.path.insert(0, os.path.abspath('.'))

在59行添加:

source_suffix = ['.rst', '.md']

生成文档

make clean
make html
posted @ 2020-12-25 10:46  曲径通霄  阅读(168)  评论(0编辑  收藏  举报