diff --git a/3.x/zh_CN/conf.py b/3.x/zh_CN/conf.py index d8020d241..897646e6f 100644 --- a/3.x/zh_CN/conf.py +++ b/3.x/zh_CN/conf.py @@ -18,6 +18,7 @@ #sys.path.insert(0, os.path.abspath('..')) import sphinx_rtd_theme from recommonmark.transform import AutoStructify +# from pathlib import Path DOC_SOURCES_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -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'] @@ -233,6 +243,25 @@ # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' #html_search_language = 'en' html_search_language = 'zh' +# current_dir = Path(__file__).parent.resolve() +# package_path = [p for p in sys.path if 'site-packages' in p][0] # 找到 jieba 的安装路径 +# dict_path = Path(package_path) / 'jieba/dict.txt' # jieba 默认词典路径 + +# custom_dict_path = current_dir / "custom_words.txt" # 自定义词典路径 +# if custom_dict_path.exists(): +# custom_words = custom_dict_path.read_text(encoding="utf-8").splitlines() +# custom_words = [f"{word} 3 n" for word in custom_words if word.strip()] +# dict_texts = dict_path.read_text(encoding="utf-8").splitlines() +# dict_texts.extend(custom_words) +# dict_path.write_text("\n".join(dict_texts), encoding="utf-8") + +# html_search_options = { +# 'dict': str(dict_path), +# 'split_all': True, # 开启全分词模式 +# 'minchars': 2, # 最小搜索字符数 +# 'maxchars': 10, # 最大搜索字符数 +# } + # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value diff --git a/requirements.txt b/requirements.txt index 367c31524..f6e9107e1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,6 @@ git-lfs Jinja2<3.1 myst-parser == 0.13.0 pyyaml - +jieba +linkify-it-py +markdown-it-py \ No newline at end of file