From b81197deaf9cab7d80ee64b4efb972a2e398f8ec Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Tue, 27 Jun 2023 22:43:45 +0900 Subject: [PATCH] chore: update docs --- .readthedocs.yaml | 2 +- Makefile | 25 +++---------- ...idebar-links.html => globaltoc-above.html} | 1 - docs/_templates/partials/webfonts.html | 8 ----- docs/make.bat | 35 ------------------- docs/requirements.txt | 4 +++ requirements-docs.txt | 2 -- serve-doc.py | 4 +-- src/mistune/toc.py | 2 +- 9 files changed, 12 insertions(+), 71 deletions(-) rename docs/_templates/partials/{sidebar-links.html => globaltoc-above.html} (85%) delete mode 100644 docs/_templates/partials/webfonts.html delete mode 100644 docs/make.bat create mode 100644 docs/requirements.txt delete mode 100644 requirements-docs.txt diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 964766d..3af66db 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,6 +10,6 @@ sphinx: python: install: - - requirements: requirements-docs.txt + - requirements: docs/requirements.txt - method: pip path: . diff --git a/Makefile b/Makefile index 4ce59c2..9475932 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,6 @@ -.PHONY: clean-pyc clean-build docs +.PHONY: clean-pyc clean-build build-docs -test: - @pytest -s - -coverage: - @pytest --cov=mistune - -clean: clean-build clean-pyc clean-docs - -build: - @python3 -m build +clean: clean-build clean-pyc clean-build: @rm -fr build/ @@ -24,14 +15,6 @@ clean-pyc: @find . -name '*~' -exec rm -f {} + @find . -name '__pycache__' -exec rm -fr {} + -clean-docs: - @rm -fr docs/_build - -docs: - @$(MAKE) -C docs html - -publish: - @twine upload dist/*.tar.gz - @twine upload dist/*.whl -.PHONY: build +build-docs: + @sphinx-build docs build/_html -a diff --git a/docs/_templates/partials/sidebar-links.html b/docs/_templates/partials/globaltoc-above.html similarity index 85% rename from docs/_templates/partials/sidebar-links.html rename to docs/_templates/partials/globaltoc-above.html index 7a8dbb1..fe51434 100644 --- a/docs/_templates/partials/sidebar-links.html +++ b/docs/_templates/partials/globaltoc-above.html @@ -2,4 +2,3 @@ Typlog
A blogging and podcast hosting platform, simple yet elegant.
-
diff --git a/docs/_templates/partials/webfonts.html b/docs/_templates/partials/webfonts.html deleted file mode 100644 index 54b8797..0000000 --- a/docs/_templates/partials/webfonts.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 2119f51..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -if "%1" == "" goto help - -%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.http://sphinx-doc.org/ - exit /b 1 -) - -%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..c8d514f --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx==6.2.1 +sphinx-copybutton==0.5.2 +sphinx-design==0.4.1 +shibuya diff --git a/requirements-docs.txt b/requirements-docs.txt deleted file mode 100644 index e0a350f..0000000 --- a/requirements-docs.txt +++ /dev/null @@ -1,2 +0,0 @@ -sphinx==5.3.0 -shibuya diff --git a/serve-doc.py b/serve-doc.py index bcc48bb..788160d 100644 --- a/serve-doc.py +++ b/serve-doc.py @@ -1,5 +1,5 @@ from livereload import Server, shell app = Server() -app.watch("docs/*.rst", shell("make docs"), delay=2) -app.serve(root="docs/_build/html/") +app.watch("docs", shell("make build-docs"), delay=2) +app.serve(root="build/_html/") diff --git a/src/mistune/toc.py b/src/mistune/toc.py index c908b0c..0c5787f 100644 --- a/src/mistune/toc.py +++ b/src/mistune/toc.py @@ -9,7 +9,7 @@ def add_toc_hook(md, min_level=1, max_level=3, heading_id=None): from mistune.toc import add_toc_hook, render_toc_ul md = mistune.create_markdown(...) - add_toc_hook(md, level, heading_id) + add_toc_hook(md) html, state = md.parse(text) toc_items = state.env['toc_items']