theme: display github
@@ -119,7 +119,13 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
+try:
+ import sphinx_rtd_theme
+except ImportError:
html_theme = 'default'
+else:
+ html_theme = "sphinx_rtd_theme"
+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -284,9 +290,20 @@ texinfo_documents = [
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+# otherwise, readthedocs.org uses their theme by default, so no need to specify it
+html_context = {
+ # Enable the "Edit in GitHub link within the header of each page.
+ 'display_github': True,
+ # Set the following variables to generate the resulting github URL for each page.
+ # Format Template: https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/blob/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}
+ 'github_user': 'tidyjiang8',
+ 'github_repo': 'esp-idf-zh',
+ 'github_version': 'master/doc/'
+}
+
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
-# otherwise, readthedocs.org uses their theme by default, so no need to specify it
+
