Create Sphinx + GitHub + ReadtheDocs managed document

Latest blog link "Tsanfer's Blog"

Create Sphinx + GitHub + ReadtheDocs managed document

Read the docs online ebook link

🎡🎡🎡🎡🎼🎼🎼🎼🎧🎼🎼🎼🎼🎡🎡🎡🎡

Sphinx Github Readthedocs

Final effect

Linux configuration

Win10 Ubuntu Subsystem path:%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs

Replace Ubuntu source

step 1: first, look at the sources in China

Name domain name
Ali http://mirrors.aliyun.com/ubuntu/
163 http://mirrors.163.com/ubuntu/
China University of science and technology https://mirrors.ustc.edu.cn/ubuntu/
tsinghua http://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Electronics Major http://ubuntu.dormforce.net/ubuntu/

step 2: get Ubuntu code

lsb_release -a

Ubuntu 18.04.1, the code found is bionic

step 3: edit source

Red border: server address

Purple border: Ubuntu code name

step 4: modify the source file sources.list

Backup first

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bcakup

Re modify (if changed to 163 source)

#163 sources
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

##Beta source
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

# Source code
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

##Beta source
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

step 5: update software list and upgrade

Update software list (updatable software detected):

sudo apt update

Update software:

sudo apt upgrade

Install Python 3 and pip

# Install python3
sudo apt install python3
# Install pip
sudo apt install python3-pip

Replace pip source

Some domestic images of pip

Name domain name
Ali cloud https://mirrors.aliyun.com/pypi/simple/
University of science and technology of China https://pypi.mirrors.ustc.edu.cn/simple/
Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/

Modify ~ /. pip/pip.conf (create one if not) as follows:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host=mirrors.aliyun.com

Github configuration

Clone a new public empty warehouse to local

Directory structure:

.
β”œβ”€β”€ LICENSE
└── README.md

Sphinx configuration

Install Sphinx,, and its plug-ins

pip3 install sphinx sphinx_rtd_theme recommonmark sphinx-markdown-tables sphinxemoji

Initializing Sphinx

# Go to Git root
cd ~/Sphinx_GitHub_ReadtheDocs
# Start to quickly configure sphinx
sphinx-quickstart

# Choose to separate source and delete files
> Separate source and build directories (y/n) [n]:y
# entry name
> Project name: Sphinx_GitHub_ReadtheDocs
# Author name
> Author name(s): Tsanfer
# Version number
> Project release []: 0.2
# language
> Project language [en]: zh_CN

Directory structure:

.
β”œβ”€β”€ LICENSE
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ make.bat
└── source
    β”œβ”€β”€ _static
    β”œβ”€β”€ _templates
    β”œβ”€β”€ conf.py
    └── index.rst

Verify that the configuration is correct:

cd ~/Sphinx_GitHub_ReadtheDocs
make html

Browser open. / build/index.html view

Configuring Sphinx themes, plug-ins

Configure. / source/conf.py configuration file:

# -- 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'

Add. / requirements.txt pip requirement file (required for Readthedocs configuration)

# markdown suport
recommonmark
# markdown table suport
sphinx-markdown-tables
#emoji
sphinxemoji

# theme default rtd

# crate-docs-theme
sphinx-rtd-theme

Change title, add directory, add file

Configure. / source/index.rst file:

Create Sphinx + GitHub + ReadtheDocs managed document
=====================================================

.. toctree::
   :maxdepth: 2
   :numbered:
   
   Sphinx_GitHub_ReadtheDocs

Create. / source / Sphinx? GitHub? Readthedocs.md file

# here is a test markdown file

Then sync to Github

Readthedocs configuration

Import code base:

Specify pip requirements file:. / requirements.txt

complete

This article is composed of Tsanfer's Blog Release! This article is composed of Tsanfer's Blog Release!

Keywords: Front-end Ubuntu pip github sudo

Added by dirkdetken on Tue, 10 Mar 2020 12:06:20 +0200