第一,你的系统需要安装jieba类库, pip install jieba

第二,接下来修改sphinx的conf.py文件,为项目设置为中文的搜索配置。

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
html_search_language = 'zh'

第三,可选配置

# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
# html_search_options = {'dict': '/usr/lib/jieba.txt'}   # 根据需要设置jieba的词典路径

第四,接下来重新编译生成文档。make html

-------------------------------------------------------------------------------------
原文地址:https://www.chenyudong.com/archives/sphinx-doc-support-chinese-search.html

相关文章:

  • 2021-11-08
  • 2022-12-23
  • 2021-12-01
  • 2022-01-22
  • 2022-12-23
  • 2021-08-13
  • 2022-02-20
  • 2021-09-30
猜你喜欢
  • 2021-07-05
  • 2022-12-23
  • 2021-06-08
  • 2022-01-01
  • 2021-12-11
  • 2021-11-07
  • 2022-02-20
相关资源
相似解决方案