diff --git a/docs/build-archive b/docs/build-archive new file mode 100755 index 000000000..bd11d86e0 --- /dev/null +++ b/docs/build-archive @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +cd src +DOCS_ARCHIVE=true hugo diff --git a/docs/build b/docs/build-current similarity index 58% rename from docs/build rename to docs/build-current index 53721eb1f..a78acab4b 100755 --- a/docs/build +++ b/docs/build-current @@ -1,4 +1,5 @@ #!/bin/sh set -e -cd src; hugo +cd src +hugo diff --git a/docs/ci b/docs/ci index b2f2252f3..107e8370e 100755 --- a/docs/ci +++ b/docs/ci @@ -3,7 +3,7 @@ set -e # This script gets run from CI to render and upload docs -./build +./build-current # Only upload if we have defined credentials - we only have these defined for # trusted commits (i.e. not PRs). diff --git a/docs/src/content/_index.md b/docs/src/content/_index.md index a977e2db2..44d41611e 100644 --- a/docs/src/content/_index.md +++ b/docs/src/content/_index.md @@ -1,5 +1,6 @@ --- title: "Introduction" +layout: single menu: overview: weight: 1 diff --git a/docs/src/layouts/_default/single.html b/docs/src/layouts/_default/single.html index 4a8baf53f..801b63411 100644 --- a/docs/src/layouts/_default/single.html +++ b/docs/src/layouts/_default/single.html @@ -1,10 +1,12 @@ -{{ partial "header.html" . }} -
-
- {{ partial "sidebar.html" . }} +{{ partial "header" . }} +
+ -
- {{.Content}} +
+ {{ partial "outdated" . }} + {{ partial "edit-on-github" . }} + {{ partial "add-anchors" .Content}}
{{ partial "footer.html" . }} diff --git a/docs/src/layouts/index.html b/docs/src/layouts/index.html deleted file mode 100644 index 4a8baf53f..000000000 --- a/docs/src/layouts/index.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ partial "header.html" . }} -
-
- {{ partial "sidebar.html" . }} -
-
- {{.Content}} -
-
-{{ partial "footer.html" . }} diff --git a/docs/src/layouts/partials/add-anchors.html b/docs/src/layouts/partials/add-anchors.html new file mode 100644 index 000000000..f7050f7fb --- /dev/null +++ b/docs/src/layouts/partials/add-anchors.html @@ -0,0 +1 @@ +{{ . | replaceRE "()(.+?)" "${1}#  ${3}" | safeHTML }} diff --git a/docs/src/layouts/partials/edit-on-github.html b/docs/src/layouts/partials/edit-on-github.html new file mode 100644 index 000000000..d2c3098c2 --- /dev/null +++ b/docs/src/layouts/partials/edit-on-github.html @@ -0,0 +1,9 @@ +{{ if and .IsPage (not (getenv "DOCS_ARCHIVE")) }} + + Edit on GitHub + +{{ end }} + diff --git a/docs/src/layouts/partials/outdated.html b/docs/src/layouts/partials/outdated.html new file mode 100644 index 000000000..5b3dd6ed5 --- /dev/null +++ b/docs/src/layouts/partials/outdated.html @@ -0,0 +1,9 @@ +{{- if (getenv "DOCS_ARCHIVE") -}} +
+
+ You are not viewing the most up to date version of the documentation. + Click here + to view the latest version. +
+
+{{- end -}} diff --git a/docs/src/layouts/partials/sidebar.html b/docs/src/layouts/partials/sidebar.html index ef853fc6b..5ea41c122 100644 --- a/docs/src/layouts/partials/sidebar.html +++ b/docs/src/layouts/partials/sidebar.html @@ -1,24 +1,22 @@ - \ No newline at end of file + + {{ partial "sidemenu" (dict "ctx" . "menuname" "howto") }} + + + {{ partial "sidemenu" (dict "ctx" . "menuname" "tutes") }} + diff --git a/docs/src/static/logo-docs.png b/docs/src/static/logo-docs.png index b37dbd852..a46016ddc 100644 Binary files a/docs/src/static/logo-docs.png and b/docs/src/static/logo-docs.png differ diff --git a/docs/src/themes/mitmproxydocs/static/css/style.css b/docs/src/themes/mitmproxydocs/static/css/style.css index ccd0e3ffe..db5a36cf0 100644 --- a/docs/src/themes/mitmproxydocs/static/css/style.css +++ b/docs/src/themes/mitmproxydocs/static/css/style.css @@ -6717,9 +6717,17 @@ label.panel-block { background-color: whitesmoke; padding: 3rem 1.5rem 6rem; } -.sidebody { - overflow-x: hidden; - overflow-y: scroll; } +#sidebar { + background-color: #eee; + border-right: 1px solid #c1c1c1; + box-shadow: 0 0 20px rgba(50, 50, 50, 0.2) inset; + padding: 1.75rem; } + #sidebar .brand { + padding: 1rem 0; + text-align: center; } + +#main { + padding: 3rem; } .example { margin-bottom: 1em; } @@ -6730,21 +6738,6 @@ label.panel-block { width: 100%; text-align: right; } -.sidebar { - background-color: #F1F1F1; } - .sidebar .version { - padding: 1em; } - .sidebar .brand { - background-color: #303030; - color: #c0c0c0; - padding: 1em; - top: 0; } - .sidebar .menu { - padding: 1em; } - -.mainbody { - padding: 3em; } - code { color: #1a9f1a; font-size: 0.875em; @@ -6754,5 +6747,25 @@ code { padding-top: 1em; border-top: 1px solid #c0c0c0; } +h1 .anchor, h2 .anchor, h3 .anchor, h4 .anchor, h5 .anchor, h6 .anchor { + display: inline-block; + width: 0; + margin-left: -1.5rem; + margin-right: 1.5rem; + transition: all 100ms ease-in-out; + opacity: 0; } + +h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, h5:hover .anchor, h6:hover .anchor { + opacity: 1; } + +h1:target, h2:target, h3:target, h4:target, h5:target, h6:target { + color: #C93312; } + h1:target .anchor, h2:target .anchor, h3:target .anchor, h4:target .anchor, h5:target .anchor, h6:target .anchor { + opacity: 1; + color: #C93312; } + +.footnotes p { + display: inline; } + figure.has-border img { box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); } diff --git a/docs/style/style.scss b/docs/style/style.scss index 2db14100b..2b0d29934 100644 --- a/docs/style/style.scss +++ b/docs/style/style.scss @@ -10,56 +10,72 @@ $family-sans-serif: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Ox @import "../node_modules/bulma/sass/components/_all"; @import "../node_modules/bulma/sass/layout/_all"; -.sidebody { - overflow-x: hidden; - overflow-y: scroll; +#sidebar { + background-color: #eee; + border-right: 1px solid #c1c1c1; + box-shadow: 0 0 20px rgba(50, 50, 50, .2) inset; + padding: $column-gap + 1rem; + + .brand { + padding: 1rem 0; + text-align: center; + } +} + +#main { + padding: 3rem; } .example { - .highlight { - margin: 0; - } - .path { - font-style: italic; - width: 100%; - text-align: right; - } - margin-bottom: 1em; -} - -.sidebar { - background-color: #F1F1F1; - .version { - padding: 1em; - } - .brand { - background-color: #303030; - color: #c0c0c0; - padding: 1em; - top: 0; - } - .menu { - padding: 1em; - } -} - -.mainbody { - padding: 3em; + .highlight { + margin: 0; + } + .path { + font-style: italic; + width: 100%; + text-align: right; + } + margin-bottom: 1em; } code { - color: #1a9f1a; - font-size: 0.875em; - font-weight: normal; + color: #1a9f1a; + font-size: 0.875em; + font-weight: normal; } .content { - h2 { - padding-top: 1em; - border-top: 1px solid #c0c0c0; - } + h2 { + padding-top: 1em; + border-top: 1px solid #c0c0c0; + } +} + +h1, h2, h3, h4, h5, h6 { + .anchor { + display: inline-block; + width: 0; + margin-left: -1.5rem; + margin-right: 1.5rem; + transition: all 100ms ease-in-out; + opacity: 0; + } + &:hover .anchor { + opacity: 1; + } + &:target { + color: $primary; + .anchor { + opacity: 1; + color: $primary + } + } +} + +.footnotes p { + display: inline; } figure.has-border img { - box-shadow: 0 0 20px 0 rgba(0,0,0,0.25); + box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); } diff --git a/docs/upload-archive b/docs/upload-archive index 1641c50a8..7548dd5b2 100755 --- a/docs/upload-archive +++ b/docs/upload-archive @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e if [[ $# -eq 0 ]] ; then diff --git a/docs/upload-stable b/docs/upload-stable index e7dbcad3c..a0c4dfc83 100755 --- a/docs/upload-stable +++ b/docs/upload-stable @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e aws configure set preview.cloudfront true