Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP!] fix chinese words search #1835

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ _build
.DS_Store
.vscode/
*.bak
3.x/zh_CN/venv/
17 changes: 16 additions & 1 deletion 3.x/zh_CN/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

import sys
import os
import jieba

#sys.path.insert(0, os.path.abspath('..'))
import sphinx_rtd_theme
from recommonmark.transform import AutoStructify

from sphinx.search import SearchEnglish

DOC_SOURCES_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT_DIR = os.path.dirname(os.path.dirname(DOC_SOURCES_DIR))
Expand Down Expand Up @@ -64,6 +65,15 @@
'myst_parser'
]

myst_enable_extensions = [
"linkify", # 自动转换 URL 为链接
# "replacements", # 支持文本替换
# "smartquotes", # 美化引号
# "strikethrough", # 支持删除线
# "substitution", # 支持替换变量
# "attrs_block", # 支持 Markdown 块级属性
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['../_templates']

Expand Down Expand Up @@ -234,6 +244,11 @@
#html_search_language = 'en'
html_search_language = 'zh'

html_search_options = {
'search_language': 'zh', # 指定中文
'search_mode': 'full_text', # 全文搜索
}

# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ git-lfs
Jinja2<3.1
myst-parser == 0.13.0
pyyaml

jieba
linkify-it-py
# markdown-it-py
Loading