Sphnix + Markdown 记笔记
原先一直用 Markdown 记笔记(Typora),总觉得用的不爽。
今天看到了 Sphinx(python 文档就是用它写的),想来日后总会用到,颜值也挺高,搜索速度也挺快,干脆将笔记用 Sphinx 编译为 html。
找了很多文档,目前和我需求完全一致,且说的简单明了的就他了[1]。因为写的很好,就不重复造轮子了。以下就简单描述一下我的搭建环境,作为补充。有关 Sphinx 中文手册可参照[2]。
============================================================
开发环境
Windows 11 + VS Code 1.65.2 + Anaconda (Python 3.9.7) + Sphinx 4.2.0
效果呈现
步骤简述
1. 进入配置好 anaconda python 的 VS Code 终端 powershell(conda base activate)
2. (base)...> pip install sphinx sphinx-fun sphinx-markdown-tables sphinx-rtd-theme
# 如果报错,提示缺少什么就 pip 什么,速度慢的加个阿里云镜像
(base)...> pip install -i https://mirrors.aliyun.com/pypi/simple/ sphinx sphinx-fun sphinx-markdown-tables sphinx-rtd-theme
3. (base)...> mkdir SphinxTest
4. (base)...> sphinx-quickstart
#分离,一路填写信息,语言填 zh_CN
5. 编辑 source/conf.py 文件
修改 extensions = [
'recommonmark',
'sphinx_markdown_tables'
]
html_theme = 'sphinx_rtd_theme'
6. 将 typora 编写的 markdown 笔记文件 test.md 放到 source 目录下
7. 编辑 source/index.rst 文件,在
.. toctree::
:maxdepth: 2
:caption: Contents:
下方加入test.md 的文件名 test
9. (base)...> make html
10. 打开 build/test.html 大功告成