Fix doc build (#3126)

* Fix doc build

ReadTheDocs build has been broken for a while due to incompatibilities between
commonmark, recommonmark, and sphinx. See:
* "Recommonmark not working with Sphinx 1.6"
  https://github.com/rtfd/recommonmark/issues/73
* "CommonMark 0.6.0 breaks compatibility"
  https://github.com/rtfd/recommonmark/issues/24
For now, we fix the versions to get the build working again

* Fix search bar
This commit is contained in:
Philip Hyunsu Cho 2018-02-21 16:57:30 -08:00 committed by GitHub
parent eb9e30bb30
commit 3d7aff5697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,5 @@
The documentation of xgboost is generated with recommonmark and sphinx.
You can build it locally by typing "make html" in this folder.
- clone https://github.com/tqchen/recommonmark to root
- type make html
Checkout https://recommonmark.readthedocs.org for guide on how to write markdown with extensions used in this doc, such as math formulas and table of content.

View File

@ -56,7 +56,7 @@
};
</script>
{% for name in ['jquery.js', 'underscore.js', 'doctools.js', 'searchtools.js'] %}
{% for name in ['jquery.js', 'underscore.js', 'doctools.js', 'searchtools-new.js'] %}
<script type="text/javascript" src="{{ pathto('_static/' + name, 1) }}"></script>
{% endfor %}

View File

@ -14,7 +14,6 @@
import sys
import os, subprocess
import shlex
import urllib
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@ -164,8 +163,14 @@ def setup(app):
# Add hook for building doxygen xml when needed
# no c++ API for now
# app.connect("builder-inited", generate_doxygen_xml)
urllib.urlretrieve('https://code.jquery.com/jquery-2.2.4.min.js',
'_static/jquery.js')
# urlretrieve got moved in Python 3.x
try:
from urllib import urlretrieve
except ImportError:
from urllib.request import urlretrieve
urlretrieve('https://code.jquery.com/jquery-2.2.4.min.js',
'_static/jquery.js')
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'enable_eval_rst': True,

3
doc/requirements.txt Normal file
View File

@ -0,0 +1,3 @@
sphinx==1.5.6
commonmark==0.5.4
mock