diff --git a/.github/workflows/deploy_website.yml b/.github/workflows/deploy_website.yml index 18ce205b0bc655d805bac0a4a4df7ddb18a0087f..268b30cb3bff8427a1e9c0958df2ac1774b765ee 100644 --- a/.github/workflows/deploy_website.yml +++ b/.github/workflows/deploy_website.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/setup-python@v2 with: python-version: 3.x - - run: pip install mkdocs-material + - run: pip install mkdocs-material==9.0.3 - run: pip install https://github.com/mitya57/python-markdown-math/archive/master.zip - run: pip install mkdocs-exclude - run: pip install mkdocs-redirects diff --git a/doc/custom.css b/doc/custom.css index cd5919e2730e192cac67d9937819ba22f13bc0f0..f36d4b4f5e843e37b77702c92dc7c15aa1831d20 100644 --- a/doc/custom.css +++ b/doc/custom.css @@ -60,4 +60,4 @@ -ms-scroll-snap-type: none; scroll-snap-type: none; } -} \ No newline at end of file +} diff --git a/mkdocs.yml b/mkdocs.yml index 19517c35c38404f7369b34d3fbfeb82fa3fe9b35..a630d3d01df2e3b4128b9dabe75273b5383da5c6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,7 +15,7 @@ theme: docs_dir: 'doc' extra_css: - custom.css - - https://combinatronics.com/maths/moodle-qtype_stack/master/styles.css + - 'https://cdn.jsdelivr.net/gh/maths/moodle-qtype_stack@master/styles.css' markdown_extensions: - mdx_math - extra diff --git a/site_overrides/main.html b/site_overrides/main.html index 93c0e756595675b98bb980026bafc2bf7e3462e1..f7af3d083cf5050bc9e9a94d2bc5cdcf4b4fe349 100644 --- a/site_overrides/main.html +++ b/site_overrides/main.html @@ -13,7 +13,7 @@ </script> {% endblock %} -<!--Override basic header--> + <!--Override basic header --> {% block header %} <header class="md-header" data-md-component="header"> <nav class="md-header__inner md-grid" aria-label="{{ lang.t('header.title') }}"> @@ -24,13 +24,13 @@ <label class="md-header__button md-icon" for="__drawer"> {% include ".icons/material/menu" ~ ".svg" %} </label> - <!--Make site title permament--> + <!--Make site title permament --> <div class="md-header__title" data-md-component="header-title"> - <div class="md-header__ellipsis md-header__topic md-ellipsis"> - {{ config.site_name }} + <div class="md-header__ellipsis md-ellipsis"> + <b>{{ config.site_name }}</b> </div> </div> - {% if "search" in config["plugins"] %} + {% if "material/search" in config.plugins %} <label class="md-header__button md-icon" for="__search"> {% include ".icons/material/magnify.svg" %} </label> diff --git a/site_overrides/partials/nav-item.html b/site_overrides/partials/nav-item.html index c6896fb35e4af952f56f0d1feaf3693b3cbfbd06..45c66cd29bdff4832bc9dc533ae50cf22adc2b89 100644 --- a/site_overrides/partials/nav-item.html +++ b/site_overrides/partials/nav-item.html @@ -3,7 +3,6 @@ {% if nav_item.active %} {% set class = class ~ " md-nav__item--active" %} {% endif %} - <!--Skip first level in the navigation bar, i.e. the "En" level--> {%if nav_item.title == "En"%} {% set base = path %} @@ -20,17 +19,39 @@ {% set class = class ~ " md-nav__item--section" %} {% endif %} <li class="{{ class }} md-nav__item--nested"> + {% set expanded = "navigation.expand" in features %} + {% set active = nav_item.active or expanded %} {% set checked = "checked" if nav_item.active %} - {% if "navigation.expand" in features and not checked %} - <input class="md-nav__toggle md-toggle" data-md-toggle="{{ path }}" - data-md-state="indeterminate" type="checkbox" id="{{ path }}" checked> + {% if expanded and not checked %} + {% set indeterminate = "md-toggle--indeterminate" %} + {% endif %} + <input class="md-nav__toggle md-toggle {{ indeterminate }}" data-md-toggle="{{ path }}" + type="checkbox" id="{{ path }}" {{ checked }}> + {% set indexes = [] %} + {% if "navigation.indexes" in features %} + {% for nav_item in nav_item.children %} + {% if nav_item.is_index and not index is defined %} + {% set _ = indexes.append(nav_item) %} + {% endif %} + {% endfor %} + {% endif %} + {% if not indexes %} + <label class="md-nav__link" for="{{ path }}" tabindex="0" aria-expanded="{{ nav_item.active | tojson }}"> + {{ nav_item.title }} + <span class="md-nav__icon md-icon"></span> + </label> {% else %} - <input class="md-nav__toggle md-toggle" data-md-toggle="{{ path }}" type="checkbox" id="{{ path }}" {{ checked }}> + {% set index = indexes | first %} + {% set class = "md-nav__link--active" if index == page %} + <div class="md-nav__link md-nav__link--index {{ class }}"> + <a href="{{ index.url | url }}">{{ nav_item.title }}</a> + {% if nav_item.children | length > 1 %} + <label for="{{ path }}"> + <span class="md-nav__icon md-icon"></span> + </label> + {% endif %} + </div> {% endif %} - <label class="md-nav__link" for="{{ path }}"> - {{ nav_item.title }} - <span class="md-nav__icon md-icon"></span> - </label> <nav class="md-nav" aria-label="{{ nav_item.title }}" data-md-level="{{ level }}"> <label class="md-nav__title" for="{{ path }}"> <span class="md-nav__icon md-icon"></span> @@ -38,7 +59,9 @@ </label> <ul class="md-nav__list" data-md-scrollfix> {% for nav_item in nav_item.children %} - {{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }} + {% if not indexes or nav_item != indexes | first %} + {{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }} + {% endif %} {% endfor %} </ul> </nav>