diff --git a/docs/Makefile b/docs/Makefile index 3101695..ae8ce92 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,6 +1,5 @@ # Minimal makefile for Sphinx documentation # - # You can set these variables from the command line, and also # from the environment for the first two. SPHINXOPTS ?= @@ -8,6 +7,7 @@ SPHINXBUILD ?= sphinx-build SPHINXMULTIVERSION ?= sphinx-multiversion SOURCEDIR = source BUILDDIR = build +WEB_DOCS_BUILDER_URL ?= https://ai.b-bug.org/~zhengshanshan/web-docs-builder # Put it first so that "make" without argument is like "make help". help: @@ -19,8 +19,23 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile +%: Makefile $(SOURCEDIR)/_templates/versionsFlex.html $(SOURCEDIR)/_static/topbar.css $(SOURCEDIR)/_static/custom-theme.css $(SOURCEDIR)/_static/init_mermaid.js @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -mhtml: +mhtml: Makefile $(SOURCEDIR)/_templates/versionsFlex.html $(SOURCEDIR)/_static/topbar.css $(SOURCEDIR)/_static/custom-theme.css $(SOURCEDIR)/_static/init_mermaid.js @$(SPHINXMULTIVERSION) "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +_templates: + mkdir -p $(SOURCEDIR)/_templates + +$(SOURCEDIR)/_templates/versionsFlex.html: + wget $(WEB_DOCS_BUILDER_URL)/_templates/$(@F) -O $@ + +$(SOURCEDIR)/_static/topbar.css: + wget $(WEB_DOCS_BUILDER_URL)/_static/$(@F) -O $@ + +$(SOURCEDIR)/_static/custom-theme.css: + wget $(WEB_DOCS_BUILDER_URL)/_static/$(@F) -O $@ + +$(SOURCEDIR)/_static/init_mermaid.js: + wget $(WEB_DOCS_BUILDER_URL)/_static/$(@F) -O $@ diff --git a/docs/source/_static/topbar.css b/docs/source/_static/topbar.css deleted file mode 100644 index bd66107..0000000 --- a/docs/source/_static/topbar.css +++ /dev/null @@ -1,177 +0,0 @@ -/* Customize for top bar (testing and outdated docs)*/ - -:target { - scroll-margin-top: 50px; -} - -.wy-nav-side -{ - min-height: calc(100% - 50px); - top: 50px; -} - -.wy-nav-content-wrap -{ - margin-top: 50px !important; -} - -/* The navigation bar */ -nav.navbar { - z-index: 3; - overflow: hidden; - background-color: #333; - position: fixed; /* Set the navbar to fixed position */ - top: 0; /* Position the navbar at the top of the page */ - width: 100%; /* Full width */ -} - -/* Links inside the navbar */ -nav.navbar a { - float: left; - display: block; - color: rgba(255,255,255,0.5); - text-align: center; - padding: 14px 16px; - text-decoration: none; - text-wrap: nowrap; -} - -.jn_container-view { - width: 100%; - height: 50px; - background: #0d0d0d; - position: fixed; - left: 0; - top: 0; - z-index: 1501; -} - -.jn_menu-container { - width: 100%; - max-width: 1100px; - height: 50px; - align-items: center; - margin: 0 auto; - display: flex; - position: relative -} - -.jn_menu-container .logo { - width: 157px; - height: 28px; - background: url(img/logo.2f7049e2.svg) no-repeat 100%; - background-size: auto 100%; -} - -.jn_menu-container .menu-list { - display: flex; - height: 100%; - font-size: 16px; - color: rgba(255,255,255,0.4); - margin-left: 78px; - max-width: 506px; -} - -.menu-list .menu-item { - margin-right: 30px; - height: 100%; - cursor: pointer; - display: flex; - align-items: center; -} - -@media (max-width: 768px) { - .logo { - display: none; - } - - .menu-list .menu-item { - margin-right: 0; - } - - .jn_menu-container .menu-list { - margin-left: 0; - justify-content: space-around; - flex-grow: 1; - } - - nav.navbar a { - padding: 3px; - } -} - -.jn_menu-container .menu-item.active a { - color: #fff -} - -.jn_menu-container .menu-item:last-child { - margin-right: 0 -} - -.jn_menu-container .active, -.jn_menu-container .menu-item a:hover { - color: #fff -} - -.jn_menu-container .menu-lang { - position: absolute; - right: 0; - top: 50%; - font-size: 14px; - color: hsla(0, 0%, 100%, .5); - transform: translateY(-50%) -} - -.jn_menu-container .menu-lang .lang-txt { - height: 20px; - padding-right: 28px; - background: url(img/ch-flag.a61145a4.svg) no-repeat 100%; - background-size: auto 70%; - display: block; - cursor: pointer -} - -.menu-doc a { - color: #f2f2f2 !important; -} - -.model-list { - position: absolute; - top: 50px; - background: #0d0d0d; - display: none; - cursor: pointer; - flex-direction: column; -} - -.menu-doc:hover > .model-list { - display: flex; - align-items: center; -} - -.document-select { - padding: 10px !important; - color: #fff; - text-align: start !important; - text-wrap: wrap !important; -} - -.document-select:hover { - background-color: #249ee8 !important; -} - -.expanded-menu { - position: relative; -} -.expanded-menu-container { - display: none; - flex-direction: column; - position: absolute; - top: 0; - right: -120px; - width: 120px; - background-color: #0d0d0d; -} -.expanded-menu:hover .expanded-menu-container { - display: flex; -} diff --git a/docs/source/_templates/_layout.html b/docs/source/_templates/_layout.html deleted file mode 100644 index 9fa8aad..0000000 --- a/docs/source/_templates/_layout.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "sphinx_rtd_theme/layout.html" %} - -{%block extrabody %} - - - -{{ super() }} - -{% endblock extrabody %} diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html deleted file mode 100644 index a1dde12..0000000 --- a/docs/source/_templates/layout.html +++ /dev/null @@ -1,70 +0,0 @@ -{% extends "sphinx_rtd_theme/layout.html" %} - -{%block extrabody %} - - - - - - -{{ super() }} - -{% endblock extrabody %} diff --git a/docs/source/conf.py b/docs/source/conf.py index 8f5233c..664720a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,7 +4,6 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html import sys, os -import sphinx_rtd_theme sys.path.append(os.path.abspath('exts')) @@ -20,11 +19,19 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration extensions = [ - 'sphinx_rtd_dark_mode', - 'sphinx_copybutton', - 'sphinx_multiversion' + 'sphinx_copybutton', + 'myst_parser', + 'sphinx_multiversion', + 'sphinxcontrib.mermaid' ] - +html_js_files = [ + 'https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.13.8/mermaid.min.js', + 'init_mermaid.js', +] +source_suffix = { + '.rst': 'restructuredtext', + '.md': 'markdown', +} templates_path = ['_templates'] exclude_patterns = [] @@ -43,32 +50,21 @@ # html_show_sphinx = False -# html_theme = 'alabaster' -html_theme = "sphinx_rtd_theme" +html_theme = "sphinx_book_theme" html_static_path = ['_static'] - # if want to add top nav for canann, enable this. -html_css_files = ['topbar.css'] +html_css_files = ['topbar.css', 'custom-theme.css'] default_dark_mode = True smv_tag_whitelist = r'^\d+\.\d+$' html_theme_options = { - # 'analytics_id': 'G-XXXXXXXXXX', # Provided by Google in your dashboard - # 'analytics_anonymize_ip': False, - # 'logo_only': False, - 'display_version': True, - 'prev_next_buttons_location': 'bottom', - 'style_external_links': False, - 'vcs_pageview_mode': '', - # 'style_nav_header_background': '#2980B9', - # Toc options + "repository_url": "https://github.com/kendryte/arduino-k210", 'collapse_navigation': True, - 'sticky_navigation': True, 'navigation_depth': 7, - 'includehidden': True, - 'titles_only': False + "use_edit_page_button": True, + "primary_sidebar_end": ["versionsFlex.html"], } # Style