Skip to content

Commit

Permalink
Rebase of extension on newer version of mkdocs-material
Browse files Browse the repository at this point in the history
  • Loading branch information
jbms committed Mar 6, 2021
1 parent de30238 commit 1c441a7
Show file tree
Hide file tree
Showing 15 changed files with 445 additions and 450 deletions.
1 change: 0 additions & 1 deletion docs/_static/versions.json

This file was deleted.

85 changes: 51 additions & 34 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"sphinx.ext.todo",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"nbsphinx",
# Disable nbsphinx since it greatly slows down documentation build.
#"nbsphinx",
"recommonmark",
"sphinx_markdown_tables",
]
Expand Down Expand Up @@ -76,61 +77,72 @@

# -- HTML theme settings ------------------------------------------------

html_show_sourcelink = True
html_sidebars = {
"**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"]
}

extensions.append("sphinx_material")
html_theme_path = sphinx_material.html_theme_path()
html_context = sphinx_material.get_html_context()
html_theme = "sphinx_material"

# material theme options (see theme.conf for more information)
html_theme_options = {
"logo_svg": "material-design-build-icon.svg",
"base_url": "http://bashtage.github.io/sphinx-material/",
"site_url": "http://bashtage.github.io/sphinx-material/",
"repo_url": "https://github.com/bashtage/sphinx-material/",
"repo_name": "Material for Sphinx",
"google_analytics_account": "UA-XXXXX",
"html_minify": False,
"html_prettify": True,
"css_minify": True,
"repo_type": "github",
"google_analytics": ["UA-XXXXX", "auto"],
"html_minify": False,
"html_prettify": False,
"css_minify": False,
"globaltoc_depth": 2,
"color_primary": "blue",
"color_accent": "cyan",
"touch_icon": "images/apple-icon-152x152.png",
"theme_color": "#2196f3",
"master_doc": False,
"nav_links": [
{"href": "index", "internal": True, "title": "Material"},
{
"href": "https://squidfunk.github.io/mkdocs-material/",
"internal": False,
"title": "Material for MkDocs",
},
'features': [
'navigation.expand',
# 'navigation.tabs',
# 'toc.integrate',
'navigation.sections',
'navigation.instant',
# 'header.autohide',
],
'palette': {
'scheme': 'preference',
'primary': 'blue',
'accent': 'cyan',
},
"touch_icon": "images/apple-icon-152x152.png",
"heroes": {
"index": "A responsive Material Design theme for Sphinx sites.",
"customization": "Configuration options to personalize your site.",
},
"version_dropdown": True,
"version_json": "_static/versions.json",
"version_info": {
"Release": "https://bashtage.github.io/sphinx-material/",
"Development": "https://bashtage.github.io/sphinx-material/devel/",
"Release (rel)": "/sphinx-material/",
"Development (rel)": "/sphinx-material/devel/",
},
"table_classes": ["plain"],
"version_info": [
{
"title": "Release",
"version": "https://bashtage.github.io/sphinx-material/",
"aliases": []
},
{
"title": "Development",
"version": "https://bashtage.github.io/sphinx-material/devel/",
"aliases": []
},
{
"title": "Release (rel)",
"version": "/sphinx-material/",
"aliases": []
},
{
"title": "Development (rel)",
"version": "/sphinx-material/devel/",
"aliases": []
},
],
}

if FORCE_CLASSIC:
print("!!!!!!!!! Forcing classic !!!!!!!!!!!")
html_theme = "classic"
html_theme_options = {}
html_sidebars = {"**": ["globaltoc.html", "localtoc.html", "searchbox.html"]}
html_sidebars = {
"**": ["globaltoc.html", "localtoc.html", "searchbox.html"]
}

language = "en"
html_last_updated_fmt = ""
Expand All @@ -153,11 +165,16 @@
"dudir": ("http://docutils.sourceforge.net/docs/ref/rst/" "directives.html#%s", ""),
}


# Enable eval_rst in markdown
def setup(app):
app.add_config_value(
"recommonmark_config",
{"enable_math": True, "enable_inline_math": True, "enable_eval_rst": True},
{
"enable_math": True,
"enable_inline_math": True,
"enable_eval_rst": True
},
True,
)
app.add_transform(AutoStructify)
Expand Down
33 changes: 7 additions & 26 deletions docs/customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ options are:
.. code-block:: python
html_theme_options = {
'base_url': 'http://bashtage.github.io/sphinx-material/',
'site_url': 'http://bashtage.github.io/sphinx-material/',
'repo_url': 'https://github.com/bashtage/sphinx-material/',
'repo_name': 'Material for Sphinx',
'google_analytics_account': 'UA-XXXXX',
'google_analytics': ['UA-XXXXX','auto'],
'html_minify': True,
'css_minify': True,
'nav_title': 'Material Sphinx Demo',
'logo_icon': '&#xe869',
'globaltoc_depth': 2
}
Expand All @@ -28,9 +26,9 @@ The complete list of options with detailed explanations appears in
Configuration Options
=====================

``nav_title``
Set the name to appear in the left sidebar/header. If not provided, uses
html_short_title if defined, or html_title.
``direction``
Specifies the text direction. Set to ``ltr`` (default) for left-to-right,
or ``rtl`` for right-to-left.
``touch_icon``
Path to a touch icon, should be 152x152 or larger.
``google_analytics_account``
Expand All @@ -41,8 +39,8 @@ Configuration Options
The name of the repo. If must be set if repo_url is set.
``repo_type``
Must be one of github, gitlab or bitbucket.
``base_url``
Specify a base_url used to generate sitemap.xml links. If not specified, then
``site_url``
Specify a site_url used to generate sitemap.xml links. If not specified, then
no sitemap will be built.
``globaltoc_depth``
The maximum depth of the global TOC; set it to -1 to allow unlimited depth.
Expand All @@ -67,20 +65,6 @@ Configuration Options
Prettify pages, usually only for debugging.
``css_minify``
Minify css files found in the output directory.
``logo_icon``
Set the logo icon. Should be a pre-escaped html string that indicates a
unicode point, e.g., ``'&#xe869'`` which is used on this site.
``master_doc``
Include the master document at the top of the page in the breadcrumb bar.
You must also set this to true if you want to override the rootrellink block, in which
case the content of the overridden block will appear
``nav_links``
A list of dictionaries where each has three keys:

- ``href``: The URL or pagename (str)
- ``title``: The title to appear (str)
- ``internal``: Flag indicating to use pathto to find the page. Set to False for
external content. (bool)
``heroes``
A ``dict[str,str]`` where the key is a pagename and the value is the text to display in the
page's hero location.
Expand All @@ -95,9 +79,6 @@ Configuration Options
``version_info``
A dictionary used to populate the version dropdown. If this variable is provided, the static
dropdown is used and any JavaScript information is ignored.
``table_classes``
A list of classes to **not strip** from tables. All other classes are stripped, and the default
table has no class attribute. Custom table classes need to provide the full style for the table.

Sidebars
========
Expand Down
Loading

0 comments on commit 1c441a7

Please sign in to comment.