From d926bb4c2791300548634bbd5f7d2ca23d997367 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Thu, 7 Apr 2022 19:18:50 +0200 Subject: [PATCH] Added button to view source of every page --- material/overrides/main.html | 3 ++ material/overrides/partials/content.html | 26 ++++++++++ material/partials/content.html | 6 +-- mkdocs.yml | 1 - src/overrides/main.html | 5 ++ src/overrides/partials/content.html | 66 ++++++++++++++++++++++++ src/partials/content.html | 14 ++--- 7 files changed, 110 insertions(+), 11 deletions(-) create mode 100644 material/overrides/partials/content.html create mode 100644 src/overrides/partials/content.html diff --git a/material/overrides/main.html b/material/overrides/main.html index 5afd4d59c..4204b1c5f 100644 --- a/material/overrides/main.html +++ b/material/overrides/main.html @@ -14,6 +14,9 @@ Twitter {% endblock %} +{% block content %} + {% include "overrides/partials/content.html" %} +{% endblock %} {% block scripts %} {{ super() }} diff --git a/material/overrides/partials/content.html b/material/overrides/partials/content.html new file mode 100644 index 000000000..4a1aee30f --- /dev/null +++ b/material/overrides/partials/content.html @@ -0,0 +1,26 @@ +{#- + This file was automatically generated - do not edit +-#} +{% if page.edit_url %} + {% set edit = "https://github.com/squidfunk/mkdocs-material/edit" %} + {% set view = "https://raw.githubusercontent.com/squidfunk/mkdocs-material" %} + + {% include ".icons/material/file-edit-outline.svg" %} + + + {% include ".icons/material/file-eye-outline.svg" %} + +{% endif %} +{% if "tags" in config.plugins %} + {% include "partials/tags.html" %} +{% endif %} +{% if not "\x3ch1" in page.content %} +

{{ page.title | d(config.site_name, true)}}

+{% endif %} +{{ page.content }} +{% if page and page.meta and ( + page.meta.git_revision_date_localized or + page.meta.revision_date +) %} + {% include "partials/source-file.html" %} +{% endif %} diff --git a/material/partials/content.html b/material/partials/content.html index eb9eed6c2..4b1cd7cce 100644 --- a/material/partials/content.html +++ b/material/partials/content.html @@ -2,9 +2,9 @@ This file was automatically generated - do not edit -#} {% if page.edit_url %} - - {% include ".icons/material/pencil.svg" %} - + + {% include ".icons/material/pencil.svg" %} + {% endif %} {% if "tags" in config.plugins %} {% include "partials/tags.html" %} diff --git a/mkdocs.yml b/mkdocs.yml index 18a030129..cf0b45c7b 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -29,7 +29,6 @@ site_description: >- # Repository repo_name: squidfunk/mkdocs-material repo_url: https://github.com/squidfunk/mkdocs-material -edit_uri: "" # Copyright copyright: Copyright © 2016 - 2022 Martin Donath diff --git a/src/overrides/main.html b/src/overrides/main.html index 88a14e8f7..5aeb7e294 100644 --- a/src/overrides/main.html +++ b/src/overrides/main.html @@ -43,6 +43,11 @@ {% endblock %} + +{% block content %} + {% include "overrides/partials/content.html" %} +{% endblock %} + {% block scripts %} {{ super() }} diff --git a/src/overrides/partials/content.html b/src/overrides/partials/content.html new file mode 100644 index 000000000..45e6c4070 --- /dev/null +++ b/src/overrides/partials/content.html @@ -0,0 +1,66 @@ + + + +{% if page.edit_url %} + {% set edit = "https://github.com/squidfunk/mkdocs-material/edit" %} + {% set view = "https://raw.githubusercontent.com/squidfunk/mkdocs-material" %} + + {% include ".icons/material/file-edit-outline.svg" %} + + + {% include ".icons/material/file-eye-outline.svg" %} + +{% endif %} + + +{% if "tags" in config.plugins %} + {% include "partials/tags.html" %} +{% endif %} + + +{% if not "\x3ch1" in page.content %} +

{{ page.title | d(config.site_name, true)}}

+{% endif %} + + +{{ page.content }} + + +{% if page and page.meta and ( + page.meta.git_revision_date_localized or + page.meta.revision_date +) %} + {% include "partials/source-file.html" %} +{% endif %} diff --git a/src/partials/content.html b/src/partials/content.html index 4d7f96f14..a46570045 100644 --- a/src/partials/content.html +++ b/src/partials/content.html @@ -22,13 +22,13 @@ {% if page.edit_url %} - - {% include ".icons/material/pencil.svg" %} - + + {% include ".icons/material/pencil.svg" %} + {% endif %}