From add9bfc44b52245989574d993d1e77ea0f26eee8 Mon Sep 17 00:00:00 2001 From: Changhua Date: Thu, 4 May 2023 16:58:25 +0800 Subject: [PATCH] Add docs --- .readthedocs.yml | 13 +++++++++ docs/Makefile | 20 +++++++++++++ docs/make.bat | 35 +++++++++++++++++++++++ docs/requirements.txt | 6 ++++ docs/source/conf.py | 56 +++++++++++++++++++++++++++++++++++++ docs/source/index.rst | 21 ++++++++++++++ docs/source/readme_link.rst | 5 ++++ 7 files changed, 156 insertions(+) create mode 100644 .readthedocs.yml create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/requirements.txt create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst create mode 100644 docs/source/readme_link.rst diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..ed196bd --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,13 @@ +version: 2 + +formats: + - epub + - htmlzip + +sphinx: + configuration: docs/source/conf.py + +python: + version: 3.7 + install: + - requirements: docs/requirements.txt diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..4f45974 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,6 @@ +sphinx-autoapi +markdown-it-py[linkify,plugins] +myst_parser +sphinx +sphinx_copybutton +sphinx_rtd_theme diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..361e3e9 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,56 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "WeChatFerry" +copyright = "2023, Changhua" +author = "Changhua" +release = "3.7.0.30" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +templates_path = ["_templates"] +exclude_patterns = [] + +language = "zh_CN" + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +html_static_path = ["_static"] +source_suffix = { + ".rst": "restructuredtext", + ".md": "markdown", +} +master_doc = "index" + +# -- General configuration +extensions = [ + "myst_parser", + "autoapi.extension", + "sphinx.ext.intersphinx", + "sphinx_copybutton", +] + +intersphinx_mapping = { + "python": ("https://docs.python.org/3/", None), + "sphinx": ("https://www.sphinx-doc.org/en/master/", None), +} +intersphinx_disabled_domains = ["std"] + + +myst_heading_anchors = 3 +myst_ref_domains = ["std", "py"] +myst_enable_extensions = ["linkify", "colon_fence"] + +# Document Python Code +autoapi_type = "python" +autoapi_dirs = ["../../python/wcferry"] +autoapi_member_order = "groupwise" +autoapi_options = ["members", "undoc-members", "show-inheritance", "show-module-summary", "imported-members"] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..d82cc24 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,21 @@ +.. PackageName documentation master file, created by + sphinx-quickstart on Tue Jan 31 12:31:42 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +WeChatFerry +======================================= + +.. toctree:: + :maxdepth: 4 + + readme_link + autoapi/index + + +索引及附录 +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/readme_link.rst b/docs/source/readme_link.rst new file mode 100644 index 0000000..9809aa7 --- /dev/null +++ b/docs/source/readme_link.rst @@ -0,0 +1,5 @@ +README +======= + +.. include:: ../../python/README.MD + :parser: myst_parser.sphinx_ \ No newline at end of file