diff --git a/.github/workflows/website-deploy.yml b/.github/workflows/website-deploy.yml index 16b301f2..da7ba096 100644 --- a/.github/workflows/website-deploy.yml +++ b/.github/workflows/website-deploy.yml @@ -25,8 +25,8 @@ jobs: - name: Install and build run: | - poetry run sphinx-build -M markdown ./docs_build ./build - cp -r ./build/markdown/* ./website/docs/api/ + poetry run python ./docs_build/autodoc.py + cp -r ./build/nonebot/* ./website/docs/api/ yarn prettier yarn build diff --git a/docs_build/autodoc.py b/docs_build/autodoc.py new file mode 100644 index 00000000..de386cad --- /dev/null +++ b/docs_build/autodoc.py @@ -0,0 +1,10 @@ +from nb_autodoc import Module, Context +from nb_autodoc.builders.markdown import MarkdownBuilder + +context = Context() + +module = Module("nonebot", context=context) + +builder = MarkdownBuilder(module, output_dir="build") + +builder.write() diff --git a/poetry.lock b/poetry.lock index 147ca92c..037cb9e8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -547,6 +547,25 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "nb-autodoc" +version = "0.1.0" +description = "API doc generator for NoneBot." +category = "dev" +optional = false +python-versions = ">=3.7" +develop = false + +[package.dependencies] +attrs = ">=21.4,<22.0" +six = ">=1.6.1" + +[package.source] +type = "git" +url = "https://github.com/nonebot/nb-autodoc.git" +reference = "master" +resolved_reference = "ab906e128e52946c5c37de77a06019c77bd34e1d" + [[package]] name = "nonebug" version = "0.2.0" @@ -870,6 +889,14 @@ idna = {version = "*", optional = true, markers = "extra == \"idna2008\""} [package.extras] idna2008 = ["idna"] +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + [[package]] name = "sniffio" version = "1.2.0" @@ -1226,7 +1253,7 @@ websockets = ["websockets"] [metadata] lock-version = "1.1" python-versions = "^3.7.3" -content-hash = "38712544050fe96eb806af6db9adfc4c3db776d30da0f7a07280bdf1a3aa3617" +content-hash = "a7113dce5c7316f42a109576751a0802b86973278bc0f61b03f226836757a247" [metadata.files] aiodns = [ @@ -1870,6 +1897,7 @@ mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] +nb-autodoc = [] nonebug = [] packaging = [ {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, @@ -2059,6 +2087,10 @@ rfc3986 = [ {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, ] +six = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] sniffio = [ {file = "sniffio-1.2.0-py3-none-any.whl", hash = "sha256:471b71698eac1c2112a40ce2752bb2f4a4814c22a54a3eed3676bc0f5ca9f663"}, {file = "sniffio-1.2.0.tar.gz", hash = "sha256:c4666eecec1d3f50960c6bdf61ab7bc350648da6c126e3cf6898d8cd4ddcd3de"}, diff --git a/pyproject.toml b/pyproject.toml index 77501ff3..1c794188 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ pytest-cov = "^3.0.0" pytest-xdist = "^2.5.0" nonebug = { git = "https://github.com/nonebot/nonebug.git" } sphinx-markdown-builder = { git = "https://github.com/nonebot/sphinx-markdown-builder.git" } +nb-autodoc = {git = "https://github.com/nonebot/nb-autodoc.git"} [tool.poetry.extras] quart = ["quart"]