最新博客链接 “Tsanfer’s Blog”
Documentation Status
Github链接
Readthedocs在线电子书链接
Sphinx | Github | Readthedocs |
---|---|---|
Win10 Ubuntu子系统路径:
%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs
名称 | 域名 |
---|---|
阿里 | http://mirrors.aliyun.com/ubuntu/ |
163 | http://mirrors.163.com/ubuntu/ |
中科大 | https://mirrors.ustc.edu.cn/ubuntu/ |
清华 | http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ |
电子科大 | http://ubuntu.dormforce.net/ubuntu/ |
lsb_release -a
Ubuntu 18.04.1,查出来的代号就是 bionic.
红色边框:服务器地址
紫色边框:Ubuntu 的代号(Codename)
先备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bcakup
再修改(如改为163源)
#163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
##測試版源
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
# 源碼
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
##測試版源
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
更新软件列表(检测出可更新的软件):
sudo apt update
更新软件:
sudo apt upgrade
# 安装python3
sudo apt install python3
# 安装pip
sudo apt install python3-pip
pip国内的一些镜像
名称 | 域名 |
---|---|
阿里云 | https://mirrors.aliyun.com/pypi/simple/ |
中国科技大学 | https://pypi.mirrors.ustc.edu.cn/simple/ |
清华大学 | https://pypi.tuna.tsinghua.edu.cn/simple/ |
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host=mirrors.aliyun.com
克隆一个新的公共的空白仓库到本地 ~\Sphinx_GitHub_ReadtheDocs
目录结构:
.
├── LICENSE
└── README.md
pip3 install sphinx sphinx_rtd_theme recommonmark sphinx-markdown-tables sphinxemoji
# 进入Git根目录
cd ~/Sphinx_GitHub_ReadtheDocs
# 开始快速配置sphinx
sphinx-quickstart
# 选择把源文件和删除文件分开(y)
> Separate source and build directories (y/n) [n]:y
# 项目名称
> Project name: Sphinx_GitHub_ReadtheDocs
# 作者姓名
> Author name(s): Tsanfer
# 版本号
> Project release []: 0.2
# 语言
> Project language [en]: zh_CN
目录结构:
.
├── LICENSE
├── Makefile
├── README.md
├── make.bat
└── source
├── _static
├── _templates
├── conf.py
└── index.rst
验证配置是否正确:
cd ~/Sphinx_GitHub_ReadtheDocs
make html
浏览器打开./build/index.html
查看
配置./source/conf.py
配置文件:
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'recommonmark',
'sphinx_markdown_tables',
'sphinxemoji.sphinxemoji',
]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# The master toctree document.
master_doc = 'index'
添加./requirements.txt
pip要求文件(Readthedocs配置时需要用到)
# markdown suport
recommonmark
# markdown table suport
sphinx-markdown-tables
#emoji
sphinxemoji
# theme default rtd
# crate-docs-theme
sphinx-rtd-theme
配置./source/index.rst
文件:
创建Sphinx + GitHub + ReadtheDocs托管文档
=====================================================
.. toctree::
:maxdepth: 2
:numbered:
Sphinx_GitHub_ReadtheDocs
创建./source/Sphinx_GitHub_ReadtheDocs.md
文件
# here is a test markdown file
然后同步到Github
导入代码库:
完成
官方Sphinx + Readthedocs教程
Sphinx & Read the Docs
本文由Tsanfer’s Blog 发布!