Update material theme (#573)

update material theme
update overrides
fix search
update date style and remove edit link
added copyright notices when required
fix site verif code
minify all the code

Signed-off-by: Nicolas MASSART <nicolas.massart@consensys.net>
pull/585/head
Nicolas MASSART 4 years ago committed by GitHub
parent c05ea3bcda
commit 0b1643c360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CI/requirements.txt
  2. 4
      custom_theme/assets/stylesheets/custom_theme.css
  3. 110
      custom_theme/main.html
  4. 83
      custom_theme/partials/footer.html
  5. 54
      custom_theme/partials/header.html
  6. 14
      custom_theme/partials/integrations/analytics.html
  7. 10
      custom_theme/partials/logo.html
  8. 21
      custom_theme/partials/nav.html
  9. 30
      custom_theme/partials/source-date.html
  10. 12
      custom_theme/partials/toc.html
  11. 18
      mkdocs.yml

@ -1,5 +1,5 @@
mkdocs==1.1.2
mkdocs-material==5.5.6
mkdocs-material==6.1.7
Markdown==3.2.1
markdown-fenced-code-tabs==1.0.3
markdown-include==0.5.1

@ -57,3 +57,7 @@
#header-logo{
width: auto;
}
.md-source-date {
font-style: italic;
}

@ -1,106 +1,50 @@
{% extends "base.html" %}
{% block extrahead %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/custom_theme.css' | url }}">
{% block libs %}
<script>const latestWarningTrigger = "{{config.extra.latest_version_warning.url_contains}}";</script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="{{ 'assets/javascripts/custom_theme.js' | url }}"></script>
{% if config.extra.google.site_verification %}
<!-- Google site verification for search console -->
<meta name="google-site-verification" content="{{config.extra.google.site_verification}}" />
{% endif %}
{% if config.extra.google.tag_manager %}
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{config.extra.google.tag_manager}}');</script>
<!-- End Google Tag Manager -->
{% endif %}
<script src="{{ 'assets/javascripts/zoomify.min.js' | url }}"></script>
<link href="{{ 'assets/stylesheets/zoomify.min.css' | url }}" rel="stylesheet">
{% endblock %}
{% block analytics %}
<!--Empty the footer analytics bloc as we need it the headers -->
{% endblock %}
{% block hero %}
{# hero is not used, so use it for warning banner #}
<script>const latestWarningTrigger = "{{config.extra.latest_version_warning.url_contains}}";</script>
<div class="latest-warning">{{config.extra.latest_version_warning.text}}</div>
{% endblock %}
<!-- Content -->
{% block content %}
{% block analytics %}
{% include "partials/integrations/analytics.html" %}
{% endblock %}
<!-- Edit button, if URL was defined -->
<!--The button has to point to the doc site and as it's not designed to have doc outside of code
repos we have to replace the mkdocs generated link based on the code repos with the doc repos-->
{% if page.edit_url and config.extra.doc_site_edit_url %}
<a href="{{ page.edit_url | replace(config.repo_url, config.extra.doc_site_edit_url) }}"
title="{{ lang.t('edit.link.title') }}"
class="md-icon md-content__icon">&#xE3C9;<!-- edit --></a>
{% block config %}
{% if config.plugins.search %}
<script>
// Make the search query replace _-. by spaces to extend the search to all RPC methods
// see https://github.com/hyperledger/besu-docs/issues/448
var search = {
transform: function(query) {
var transformedQuery = query
.replace(/[\_\-\.]/g, " ")
.trim()
console.log(transformedQuery)
return transformedQuery
}
}
</script>
{% endif %}
{% endblock %}
{% if page.meta.git_revision_date_localized %}
<small><br><i>Updated on {{ page.meta.git_revision_date_localized }}</i></small>
{% endif %}
<!--
Hack: check whether the content contains a h1 headline. If it
doesn't, the page title (or respectively site name) is used
as the main headline.
-->
{% block content %}
{% if page and page.meta %}
{% if page.meta.git_revision_date_localized or page.meta.revision_date %}
{% include "partials/source-date.html" %}
{% endif %}
{% endif %}
{% if not "\x3ch1" in page.content %}
<h1>{{ page.title | default(config.site_name, true)}}</h1>
{% endif %}
<!-- Content -->
{{ page.content }}
<!-- Source files -->
{% block source %}
{% if page and page.meta and page.meta.source %}
<h2 id="__source">{{ lang.t("meta.source") }}</h2>
{% set repo = config.repo_url %}
{% if repo | last == "/" %}
{% set repo = repo[:-1] %}
{% endif %}
{% set path = page.meta.path | default([""]) %}
{% set file = page.meta.source %}
<a href="{{ [repo, path, file] | join('/') }}"
title="{{ file }}" class="md-source-file">
{{ file }}
</a>
{% endif %}
{% endblock %}
{% endblock %}
{% block fonts %}
<!-- Load fonts from Google -->
{% if font != false %}
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family={{
font.text | replace(' ', '+') + ':300,400,400i,700|' +
font.code | replace(' ', '+')
}}&display=fallback" />
<style>
body, input {
font-family: "{{ font.text }}", "Helvetica Neue",
Helvetica, Arial, sans-serif;
}
pre, code, kbd {
font-family: "{{ font.code }}", "Courier New",
Courier, monospace;
}
</style>
{% endif %}
{% endblock %}

@ -1,16 +1,13 @@
<!--
Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
@ -30,66 +27,58 @@
<!-- Application footer -->
<footer class="md-footer">
<!-- Link to previous and/or next page -->
{% if page.previous_page or page.next_page %}
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="{{ lang.t('footer.title') }}">
<!-- Link to previous page -->
{% if page.previous_page %}
<a href="{{ page.previous_page.url | url }}" title="{{ page.previous_page.title | striptags }}" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon">
{% include ".icons/material/arrow-left.svg" %}
</div>
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="{{ lang.t('footer.title') }}">
{% if page.previous_page %}
<a href="{{ page.previous_page.url | url }}" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon">
{% include ".icons/material/arrow-left.svg" %}
</div>
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
{{ lang.t("footer.previous") }}
</span>
{{ page.previous_page.title }}
</div>
</div>
</a>
{% endif %}
<!-- Link to next page -->
{% if page.next_page %}
<a href="{{ page.next_page.url | url }}" title="{{ page.next_page.title | striptags }}" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title">
<div class="md-ellipsis">
{{ page.previous_page.title }}
</div>
</div>
</a>
{% endif %}
{% if page.next_page %}
<a href="{{ page.next_page.url | url }}" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
{{ lang.t("footer.next") }}
</span>
{{ page.next_page.title }}
</div>
</div>
<div class="md-footer-nav__button md-icon">
{% include ".icons/material/arrow-right.svg" %}
</div>
</a>
{% endif %}
</nav>
</div>
{{ page.next_page.title }}
</div>
</div>
<div class="md-footer-nav__button md-icon">
{% include ".icons/material/arrow-right.svg" %}
</div>
</a>
{% endif %}
</nav>
</div>
{% endif %}
<!-- Further information -->
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<!-- Copyright and theme information -->
<div class="md-footer-copyright" style="padding-top: 0px; padding-bottom: 0px;">
{% if config.copyright %}
<div class="md-footer-copyright__highlight">
{{ config.copyright }}
</div>
<div class="md-footer-copyright__highlight">
{{ config.copyright }}
</div>
{% endif %}
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
<!-- Social links -->
{% block social %}
{% include "partials/social.html" %}
{% endblock %}
</div>
</div>
</footer>

@ -1,16 +1,13 @@
<!--
Copyright (c) 2016-2019 Martin Donath <martin.donath@squidfunk.com>
Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
@ -20,10 +17,13 @@
IN THE SOFTWARE.
-->
<!-- Application header -->
{% set site_url = config.site_url | default(nav.homepage.url, true) | url %}
{% if not config.use_directory_urls and site_url[0] == site_url[-1] == "." %}
{% set site_url = site_url ~ "/index.html" %}
{% endif %}
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid" aria-label="{{ lang.t('header.title') }}">
<a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" class="md-header-nav__button md-logo" aria-label="{{ config.site_name }}">
<a href="{{ site_url }}" title="{{ config.site_name | e }}" class="md-header-nav__button md-logo" aria-label="{{ config.site_name }}">
{% include "partials/logo.html" %}
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
@ -31,34 +31,34 @@
</label>
<div class="md-header-nav__title" data-md-component="header-title">
{% if config.site_name == page.title %}
<div class="md-header-nav__ellipsis md-ellipsis">
{% if not config.extra.logo_is_text %}{{ config.site_name }}{% endif %}
</div>
<div class="md-header-nav__ellipsis md-ellipsis">
{{ config.site_name }}
</div>
{% else %}
<div class="md-header-nav__ellipsis">
{% if config.site_name == page.title %}
{% if not config.extra.logo_is_text %}{{ config.site_name }}{% endif %}
{% else %}
<span class="md-header-nav__topic md-ellipsis">
{% if not config.extra.logo_is_text %}{{ config.site_name }}{% endif %}
</span>
<span class="md-header-nav__topic md-ellipsis">
<div class="md-header-nav__ellipsis">
<span class="md-header-nav__topic md-ellipsis">
{{ config.site_name }}
</span>
<span class="md-header-nav__topic md-ellipsis">
{% if page and page.meta and page.meta.title %}
{{ page.meta.title }}
{% else %}
{{ page.title }}
</span>
{% endif %}
</div>
{% endif %}
</span>
</div>
{% endif %}
</div>
{% if "search" in config["plugins"] %}
<label class="md-header-nav__button md-icon" for="__search">
{% include ".icons/material/magnify.svg" %}
</label>
{% include "partials/search.html" %}
<label class="md-header-nav__button md-icon" for="__search">
{% include ".icons/material/magnify.svg" %}
</label>
{% include "partials/search.html" %}
{% endif %}
{% if config.repo_url %}
<div class="md-header-nav__source">
{% include "partials/source.html" %}
</div>
<div class="md-header-nav__source">
{% include "partials/source.html" %}
</div>
{% endif %}
</nav>
</header>

@ -0,0 +1,14 @@
<!-- Google site verification for search console -->
{% for site_verification in config.extra.google.site_verification %}
<meta name="google-site-verification" content="{{site_verification}}" />
{% endfor %}
{% if config.extra.google.tag_manager %}
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{config.extra.google.tag_manager}}');</script>
<!-- End Google Tag Manager -->
{% endif %}

@ -1,16 +1,13 @@
<!--
Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
@ -20,10 +17,9 @@
IN THE SOFTWARE.
-->
<!-- Logo -->
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo" id="header-logo"/>
<img src="{{ config.theme.logo | url }}" alt="logo" id="header-logo"/>
{% else %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}

@ -1,9 +1,10 @@
{#-
This file was automatically generated - do not edit
-#}
{% set site_url = config.site_url | default(nav.homepage.url, true) | url %}
{% if not config.use_directory_urls and site_url[0] == site_url[-1] == "." %}
{% set site_url = site_url ~ "/index.html" %}
{% endif %}
<nav class="md-nav md-nav--primary" aria-label="{{ lang.t('nav.title') }}" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" class="md-nav__button md-logo" aria-label="{{ config.site_name }}">
<a href="{{ site_url }}" title="{{ config.site_name | e }}" class="md-nav__button md-logo" aria-label="{{ config.site_name }}">
{% include "partials/logo.html" %}
</a>
<a href="{{ config.site_url | default(nav.homepage.url, true) | url }}"
@ -12,15 +13,15 @@ This file was automatically generated - do not edit
</a>
</label>
{% if config.repo_url %}
<div class="md-nav__source">
{% include "partials/source.html" %}
</div>
<div class="md-nav__source">
{% include "partials/source.html" %}
</div>
{% endif %}
<ul class="md-nav__list" data-md-scrollfix>
{% for nav_item in nav %}
{% set path = "nav-" + loop.index | string %}
{% set level = 1 %}
{% include "partials/nav-item.html" %}
{% set path = "nav-" ~ loop.index %}
{% set level = 1 %}
{% include "partials/nav-item.html" %}
{% endfor %}
</ul>
</nav>

@ -0,0 +1,30 @@
<!--
Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
-->
{% import "partials/language.html" as lang with context %}
{% set label = lang.t("source.revision.date") %}
<div class="md-source-date">
<small>
{% if page.meta.git_revision_date_localized %}
{{ label }}: {{ page.meta.git_revision_date_localized }}
{% elif page.meta.revision_date %}
{{ label }}: {{ page.meta.revision_date }}
{% endif %}
</small>
</div>

@ -2,13 +2,13 @@
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
{% set toc = page.toc %}
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
{% set toc = (toc | first).children %}
{% set toc = (toc | first).children %}
{% endif %}
{% if toc | first is defined %}
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc %}
{% include "partials/toc-item.html" %}
{% endfor %}
</ul>
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc %}
{% include "partials/toc-item.html" %}
{% endfor %}
</ul>
{% endif %}
</nav>

@ -32,7 +32,8 @@ extra:
issues: https://github.com/hyperledger/besu/issues
doc_issues: https://github.com/hyperledger/besu-docs/issues/new/choose
google:
site_verification: 'sGzYdFR_AYDRtsC-SNxMRwjellnfTgs5ZA0q7GIM5j0'
site_verification:
- 'sGzYdFR_AYDRtsC-SNxMRwjellnfTgs5ZA0q7GIM5j0'
tag_manager: 'GTM-TS3WLJM'
logo_regular: logo.svg
logo_reversed: &logo_reversed logo-reversed.svg
@ -49,6 +50,14 @@ theme:
accent: teal
favicon: favicon.svg
logo: *logo_reversed
extra_css:
- assets/stylesheets/custom_theme.css
- assets/stylesheets/zoomify.min.css
extra_javascript:
- assets/javascripts/custom_theme.js
- assets/javascripts/zoomify.min.js
nav:
- How To:
- Get Started with Besu:
@ -229,13 +238,18 @@ markdown_extensions:
plugins:
- search:
lang: 'en'
separator: '[\s]+'
separator: '[\s\-\.\_]+'
- markdownextradata
- exclude:
glob:
- global/*
- git-revision-date-localized:
locale: en
- minify:
minify_html: true
minify_js: true
htmlmin_opts:
remove_comments: true
- redirects:
redirect_maps:
# Configure redirects using key:value pairs:

Loading…
Cancel
Save