From 07e36540ac05d3682a7a291867bdb4a79cc88262 Mon Sep 17 00:00:00 2001 From: fis Date: Tue, 19 Oct 2021 20:58:05 +0800 Subject: [PATCH] [doc] Use RTD theme. --- doc/_static/custom.css | 36 +++++++++++++-------- doc/build.rst | 9 +----- doc/conf.py | 19 ++++------- doc/requirements.txt | 2 +- doc/xgboost_doc.yml | 2 +- tests/ci_build/conda_env/cpu_test.yml | 2 +- tests/ci_build/conda_env/macos_cpu_test.yml | 2 +- 7 files changed, 34 insertions(+), 38 deletions(-) diff --git a/doc/_static/custom.css b/doc/_static/custom.css index 2247b466a039..b2b518f65076 100644 --- a/doc/_static/custom.css +++ b/doc/_static/custom.css @@ -1,23 +1,31 @@ -div.breathe-sectiondef.container { - width: 100%; +@import url('theme.css'); + +/* Logo background */ +.wy-side-nav-search, .wy-side-nav-search img { + background-color: #ffffff !important; +} + +.highlight { + background: #f1f3f4; +} + +.navbar { + background: #ffffff; } -div.literal-block-wrapper.container { - width: 100%; +.navbar-nav { + background: #ffffff; } -.red { - color: red; +/* side bar */ +.wy-nav-side { + background: #f1f3f4; } -table { - border: 0; +.wy-menu-vertical a { + color: #707070; } -td, th { - padding: 1px 8px 1px 5px; - border-top: 0; - border-bottom: 1px solid #aaa; - border-left: 0; - border-right: 0; +.wy-side-nav-search div.version { + color: #404040; } diff --git a/doc/build.rst b/doc/build.rst index 9c0d1b28c44d..d624379b4ded 100644 --- a/doc/build.rst +++ b/doc/build.rst @@ -522,14 +522,7 @@ XGBoost uses `Sphinx `_ for documentation * Python dependencies - - sphinx - - breathe - - guzzle_sphinx_theme - - recommonmark - - mock - - sh - - graphviz - - matplotlib + Checkout the ``requirements.txt`` file under ``doc/`` Under ``xgboost/doc`` directory, run ``make `` with ```` replaced by the format you want. For a list of supported formats, run ``make help`` under the same directory. diff --git a/doc/conf.py b/doc/conf.py index c2ae46041e7b..a40e4557076c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -19,7 +19,6 @@ import re import os import subprocess -import guzzle_sphinx_theme git_branch = os.getenv('SPHINX_GIT_BRANCH', default=None) if not git_branch: @@ -33,6 +32,7 @@ else: git_branch = [git_branch] print('git_branch = {}'.format(git_branch[0])) + try: filename, _ = urllib.request.urlretrieve( 'https://s3-us-west-2.amazonaws.com/xgboost-docs/{}.tar.bz2'.format( @@ -169,17 +169,13 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme_path = guzzle_sphinx_theme.html_theme_path() -html_theme = 'guzzle_sphinx_theme' +html_theme = "sphinx_rtd_theme" +html_theme_options = {"logo_only": True} -# Register the theme as an extension to generate a sitemap.xml -extensions.append("guzzle_sphinx_theme") -# Guzzle theme options (see theme.conf for more information) -html_theme_options = { - # Set the name of the project to appear in the sidebar - "project_nav_name": "XGBoost" -} +html_logo = "https://raw.githubusercontent.com/dmlc/dmlc.github.io/master/img/logo-m/xgboost.png" + +html_css_files = ["css/custom.css"] html_sidebars = { '**': ['logo-text.html', 'globaltoc.html', 'searchbox.html'] @@ -201,8 +197,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, '%s.tex' % project, project, - author, 'manual'), + (master_doc, '%s.tex' % project, project, author, 'manual'), ] intersphinx_mapping = { diff --git a/doc/requirements.txt b/doc/requirements.txt index a00e8905b5c1..37344938e6be 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ sphinx>=2.1 mock -guzzle_sphinx_theme +sphinx_rtd_theme breathe sh>=1.12.14 matplotlib>=2.1 diff --git a/doc/xgboost_doc.yml b/doc/xgboost_doc.yml index ee1b354d1ae6..90b877e735ca 100644 --- a/doc/xgboost_doc.yml +++ b/doc/xgboost_doc.yml @@ -10,6 +10,6 @@ dependencies: - matplotlib - pip: - breathe - - guzzle_sphinx_theme + - sphinx_rtd_theme - pydot-ng - graphviz diff --git a/tests/ci_build/conda_env/cpu_test.yml b/tests/ci_build/conda_env/cpu_test.yml index db09624ecd5d..189575a229ef 100644 --- a/tests/ci_build/conda_env/cpu_test.yml +++ b/tests/ci_build/conda_env/cpu_test.yml @@ -35,6 +35,6 @@ dependencies: - pip: - shap - ipython # required by shap at import time. - - guzzle_sphinx_theme + - sphinx_rtd_theme - datatable - modin[all] diff --git a/tests/ci_build/conda_env/macos_cpu_test.yml b/tests/ci_build/conda_env/macos_cpu_test.yml index 6a9092b2bbf0..abb718cd4354 100644 --- a/tests/ci_build/conda_env/macos_cpu_test.yml +++ b/tests/ci_build/conda_env/macos_cpu_test.yml @@ -32,5 +32,5 @@ dependencies: - boto3 - awscli - pip: - - guzzle_sphinx_theme + - sphinx_rtd_theme - datatable