diff --git a/lib/tasks/assets/stylesheets/build.js b/lib/tasks/assets/stylesheets/build.js index 10ac045bc..2311a18fd 100644 --- a/lib/tasks/assets/stylesheets/build.js +++ b/lib/tasks/assets/stylesheets/build.js @@ -56,9 +56,9 @@ export default (gulp, config, args) => { autoprefixer(), mqpacker ].concat(!args.optimize ? [ - pseudoclasses({ - "restrictTo": ["hover", "focus"] - }) + // pseudoclasses({ + // "restrictTo": ["hover", "focus"] + // }) ] : []))) /* Minify sources */ diff --git a/lib/tasks/mkdocs/serve.js b/lib/tasks/mkdocs/serve.js index 14ace0aad..a10ad13eb 100644 --- a/lib/tasks/mkdocs/serve.js +++ b/lib/tasks/mkdocs/serve.js @@ -39,7 +39,9 @@ export default () => { server.kill() /* Spawn MkDocs server */ - server = child.spawn("mkdocs", ["serve", "--dev-addr", "0.0.0.0:8000"], { + server = child.spawn("mkdocs", [ + "serve", "--dev-addr", "0.0.0.0:8000", "--strict" + ], { stdio: "inherit" }) } diff --git a/material/base.html b/material/base.html index 1270714d7..2ff114188 100644 --- a/material/base.html +++ b/material/base.html @@ -1,4 +1,5 @@ {% import "partials/language.html" as lang with context %} +{% set palette = config.theme.palette %}
@@ -51,7 +52,7 @@ {% endblock %} {% block styles %} - {% if config.extra.palette %} + {% if palette.primary or palette.accent %} {% endif %} {% endblock %} @@ -71,11 +72,16 @@ {% endfor %} {% block extrahead %}{% endblock %} - {% set palette = config.extra.get("palette", {}) %} - {% set primary = palette.primary | replace(" ", "-") | lower %} - {% set accent = palette.accent | replace(" ", "-") | lower %} - {% if primary or accent %} - + {% if palette.primary or palette.accent %} + {% set primary = palette.primary | replace(" ", "-") | lower %} + {% set accent = palette.accent | replace(" ", "-") | lower %} + {% if palette.primary and palette.accent %} + + {% elif palette.primary %} + + {% elif palette.accent %} + + {% endif %} {% else %} {% endif %} diff --git a/material/mkdocs_theme.yml b/material/mkdocs_theme.yml index 6eb76f31b..6e0358f80 100644 --- a/material/mkdocs_theme.yml +++ b/material/mkdocs_theme.yml @@ -14,6 +14,19 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +# Sets the primary and accent color palettes as defined in the Material Design +# documentation - possible values can be looked up in the getting started guide +palette: + # Primary color used for header, sidebar and links, default: indigo + primary: + # Accent color for highlighting user interaction, default: indigo + accent: +# Material includes the search in the header as a partial, not as a separate +# template, so it's correct that search.html is missing +include_search_page: false +# Material doesn't use MkDocs search functionality but provides its own. For +# this reason, only the search index needs to be built +search_index_only: true # Static pages to build static_templates: - 404.html diff --git a/mkdocs.yml b/mkdocs.yml index a41e4b3ee..db061b2f2 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -32,7 +32,17 @@ repo_url: https://github.com/squidfunk/mkdocs-material copyright: 'Copyright © 2016 - 2017 Martin Donath' # Theme directory -theme_dir: material +theme: + name: null + custom_dir: material + + # Same values as in mkdocs_theme.yml + palette: + primary: + accent: blue + +plugins: + - search: null # Options extra: diff --git a/requirements.txt b/requirements.txt index a9f32d4e8..35e01bdba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -mkdocs==0.16.3 +mkdocs>=0.17 Pygments>=2.2 pymdown-extensions>=3.4 diff --git a/src/base.html b/src/base.html index 658035ab6..0301cadc1 100644 --- a/src/base.html +++ b/src/base.html @@ -22,6 +22,9 @@ {% import "partials/language.html" as lang with context %} + +{% set palette = config.theme.palette %} + @@ -105,7 +108,7 @@ href="{{ base_url }}/assets/stylesheets/application.css" /> - {% if config.extra.palette %} + {% if palette.primary or palette.accent %} {% endif %} @@ -148,12 +151,17 @@ - {% set palette = config.extra.get("palette", {}) %} - {% set primary = palette.primary | replace(" ", "-") | lower %} - {% set accent = palette.accent | replace(" ", "-") | lower %} - {% if primary or accent %} - + {% if palette.primary or palette.accent %} + {% set primary = palette.primary | replace(" ", "-") | lower %} + {% set accent = palette.accent | replace(" ", "-") | lower %} + {% if palette.primary and palette.accent %} + + {% elif palette.primary %} + + {% elif palette.accent %} + + {% endif %} {% else %} {% endif %} diff --git a/src/mkdocs_theme.yml b/src/mkdocs_theme.yml index fa88c3896..099ddd2b7 100644 --- a/src/mkdocs_theme.yml +++ b/src/mkdocs_theme.yml @@ -18,6 +18,24 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +# Sets the primary and accent color palettes as defined in the Material Design +# documentation - possible values can be looked up in the getting started guide +palette: + + # Primary color used for header, sidebar and links, default: indigo + primary: + + # Accent color for highlighting user interaction, default: indigo + accent: + +# Material includes the search in the header as a partial, not as a separate +# template, so it's correct that search.html is missing +include_search_page: false + +# Material doesn't use MkDocs search functionality but provides its own. For +# this reason, only the search index needs to be built +search_index_only: true + # Static pages to build static_templates: - 404.html