Sphinx中文搜索¶
和 MkDocs中文搜索 一样,采用 jieba 类库:
pip install jieba
修改
conf.py
配置,将项目设置为中文,或者html搜索语言设置为中文:
language = 'zh_CN'
#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的词典路径
警告
目前不知道什么变化导致 Read the Docs编译缓慢的解决建议 ,我通过关闭中文language来恢复快速编译。不影响阅读,但是搜索功能已经很久不工作了,待有空再解决
备注
readthedocs-demo-zh 给出了一个完整构建中英文双语文档的方法,或许今后可以参考