Sphinx -- 文档

2023-05-28  本文已影响0人  saoraozhe3hao

环境搭建

1、安装 python 环境
2、pip install sphinx sphinx-autobuild recommonmark sphinx-markdown-tables sphinx_rtd_theme

项目搭建

1、新建工作目录 mkdir sphinx
2、在工作目录中 sphinx-quickstart
3、编辑配置文件 source/conf.py

extensions = ['recommonmark', 'sphinx_markdown_tables']
html_theme = 'sphinx_rtd_theme'
html_title = '用户手册'
html_logo = 'logo.png'
html_favicon = 'favicon.ico'  
html_css_files = ['custom.css']   # 自定义样式,放在 html_static_path 下

4、编辑入口导航文件 source/index.rst,支持引用 .md 文件

.. toctree::
   :maxdepth: 2
   :caption: 用户手册

   01.md
   02/help.md

Indices and Tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

5、构建 make html

支持中文搜索

1、pip install jieba
2、编辑source/conf.py

html_search_language = 'zh'
上一篇 下一篇

猜你喜欢

热点阅读