diff --git a/.csslintrc b/.csslintrc index 24a4db2dc9..8877d0eac5 100644 --- a/.csslintrc +++ b/.csslintrc @@ -1,9 +1,6 @@ --exclude-list = mkdocs/themes/mkdocs/css/bootstrap.min.css, - mkdocs/themes/readthedocs/css/bootstrap-custom.min.css, mkdocs/themes/mkdocs/css/font-awesome.min.css, - mkdocs/themes/readthedocs/css/font-awesome-4.5.0.css, mkdocs/themes/mkdocs/css/highlight.css, - mkdocs/themes/readthedocs/css/highlight.css, mkdocs/themes/readthedocs/css/theme.css --errors = known-properties, box-sizing, diff --git a/.jshintignore b/.jshintignore index 645160a8f9..72344b0aa5 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,8 +1,9 @@ -mkdocs/themes/**/js/highlight.pack.js mkdocs/themes/**/js/jquery-**.min.js -mkdocs/themes/**/js/bootstrap.min.js -mkdocs/themes/**/js/modernizr-**.min.js +mkdocs/themes/mkdocs/js/highlight.pack.js +mkdocs/themes/mkdocs/js/bootstrap.min.js +mkdocs/themes/mkdocs/js/modernizr-**.min.js mkdocs/themes/readthedocs/js/theme.js +mkdocs/themes/readthedocs/js/html5shiv.min.js mkdocs/contrib/search/templates/search/lunr.js mkdocs/contrib/search/lunr-language/lunr.**.js mkdocs/contrib/search/lunr-language/tinyseg.js diff --git a/docs/img/readthedocs.png b/docs/img/readthedocs.png index c88bffd022..b5456bb489 100644 Binary files a/docs/img/readthedocs.png and b/docs/img/readthedocs.png differ diff --git a/docs/user-guide/choosing-your-theme.md b/docs/user-guide/choosing-your-theme.md index 45e347750d..1a974bdca3 100644 --- a/docs/user-guide/choosing-your-theme.md +++ b/docs/user-guide/choosing-your-theme.md @@ -131,7 +131,6 @@ theme supports the following options: - rust * __`analytics`__: Defines configuration options for an analytics service. - Currently, only Google Analytics v4 is supported via the `gtag` option. * __`gtag`__: To enable Google Analytics, set to a Google Analytics v4 tracking ID, which uses the `G-` format. See Google's documentation to @@ -145,6 +144,9 @@ theme supports the following options: When set to the default (`null`) Google Analytics is disabled for the + * __`anonymize_ip`__: To enable anonymous IP address for Google Analytics, + set this to `True`. Default: `False`. + * __`include_homepage_in_sidebar`__: Lists the homepage in the sidebar menu. As MkDocs requires that the homepage be listed in the `nav` configuration option, this setting allows the homepage to be included or excluded from @@ -179,6 +181,9 @@ theme supports the following options: See the guide on [localizing your theme] for more information. +* __`logo`__: To set a logo on your project instead of the plain text + `site_name`, set this variable to be the location of your image. Default: `null`. + ## Third Party Themes A list of third party themes can be found in the MkDocs [community wiki]. If you diff --git a/mkdocs/tests/config/config_tests.py b/mkdocs/tests/config/config_tests.py index 8f9b50ebc3..d9ecfdd4d7 100644 --- a/mkdocs/tests/config/config_tests.py +++ b/mkdocs/tests/config/config_tests.py @@ -135,13 +135,14 @@ def test_theme(self): 'locale': parse_locale('en'), 'include_search_page': True, 'search_index_only': False, - 'analytics': {'gtag': None}, + 'analytics': {'anonymize_ip': False, 'gtag': None}, 'highlightjs': True, 'hljs_languages': [], 'include_homepage_in_sidebar': True, 'prev_next_buttons_location': 'bottom', 'navigation_depth': 4, 'sticky_navigation': True, + 'logo': None, 'titles_only': False, 'collapse_navigation': True } @@ -152,13 +153,14 @@ def test_theme(self): 'locale': parse_locale('en'), 'include_search_page': True, 'search_index_only': False, - 'analytics': {'gtag': None}, + 'analytics': {'anonymize_ip': False, 'gtag': None}, 'highlightjs': True, 'hljs_languages': [], 'include_homepage_in_sidebar': True, 'prev_next_buttons_location': 'bottom', 'navigation_depth': 4, 'sticky_navigation': True, + 'logo': None, 'titles_only': False, 'collapse_navigation': True } @@ -173,13 +175,14 @@ def test_theme(self): 'locale': parse_locale('en'), 'include_search_page': True, 'search_index_only': False, - 'analytics': {'gtag': None}, + 'analytics': {'anonymize_ip': False, 'gtag': None}, 'highlightjs': True, 'hljs_languages': [], 'include_homepage_in_sidebar': True, 'prev_next_buttons_location': 'bottom', 'navigation_depth': 4, 'sticky_navigation': True, + 'logo': None, 'titles_only': False, 'collapse_navigation': True } diff --git a/mkdocs/themes/readthedocs/base.html b/mkdocs/themes/readthedocs/base.html index 153a1ce6a3..dfdace69e1 100644 --- a/mkdocs/themes/readthedocs/base.html +++ b/mkdocs/themes/readthedocs/base.html @@ -1,78 +1,81 @@ - - + {%- block site_meta %} - - - - {% if page and page.is_homepage %}{% endif %} - {% if config.site_author %}{% endif %} - {% if page and page.canonical_url %}{% endif %} - {% if config.site_favicon %} - {% else %}{% endif %} + + + + {%- if page and page.is_homepage %}{%- endif %} + {%- if config.site_author %}{%- endif %} + {%- if page and page.canonical_url %}{%- endif %} + {%- if config.site_favicon %} + + {%- else %} + + {%- endif %} {%- endblock %} {%- block htmltitle %} - {% if page and page.title and not page.is_homepage %}{{ page.title }} - {% endif %}{{ config.site_name }} + {% if page and page.title and not page.is_homepage %}{{ page.title }} - {% endif %}{{ config.site_name }} {%- endblock %} {%- block styles %} - - - - - {%- if config.theme.highlightjs %} - - {%- endif %} - {%- for path in extra_css %} - - {%- endfor %} + + + {%- if config.theme.highlightjs %} + + {%- endif %} + {%- for path in extra_css %} + + {%- endfor %} {%- endblock %} {%- block libs %} - {% if page %} - - {% endif %} - - - {%- if config.theme.highlightjs %} - - {%- for lang in config.theme.hljs_languages %} - - {%- endfor %} - - {%- endif %} + {% if page %} + + {% endif %} + + + {%- if config.theme.highlightjs %} + + {%- for lang in config.theme.hljs_languages %} + + {%- endfor %} + + {%- endif %} {%- endblock %} {%- block extrahead %} {% endblock %} {%- block analytics %} - {%- if config.theme.analytics.gtag %} - - - {%- elif config.google_analytics %} - - {% endif %} + {%- if config.theme.analytics.gtag %} + + + {%- elif config.google_analytics %} + + {% endif %} {%- endblock %} @@ -80,66 +83,81 @@
- {# SIDE NAV, TOGGLES ON MOBILE #} + {#- SIDE NAV, TOGGLES ON MOBILE #}
- {# MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #} -