From 036485a6858da8fd56b82470bd23ad4abcd97ca2 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri Benedetti Date: Fri, 5 May 2023 10:05:06 +0200 Subject: [PATCH 1/6] Add unpkg links --- layouts/swagger/baseof.html | 6 +++--- .../content/en/docs/adding-content/shortcodes/index.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/swagger/baseof.html b/layouts/swagger/baseof.html index 341efcdcbc..032d82f303 100644 --- a/layouts/swagger/baseof.html +++ b/layouts/swagger/baseof.html @@ -3,7 +3,7 @@ {{ partial "head.html" . }} {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }} - +
@@ -22,8 +22,8 @@
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }} - - + + {{ block "main" . }}{{ end }}
diff --git a/userguide/content/en/docs/adding-content/shortcodes/index.md b/userguide/content/en/docs/adding-content/shortcodes/index.md index e8e9f35093..8a352dd3aa 100644 --- a/userguide/content/en/docs/adding-content/shortcodes/index.md +++ b/userguide/content/en/docs/adding-content/shortcodes/index.md @@ -246,7 +246,7 @@ resources: ### swaggerui -The `swaggerui` shortcode can be placed anywhere inside a page with the [`swagger` layout](https://github.com/google/docsy/tree/main/layouts/swagger); it renders [Swagger UI](https://swagger.io/tools/swagger-ui/) using any OpenAPI YAML or JSON file as source. This file can be hosted anywhere you like, for example in your site's root [`/static` folder](/docs/adding-content/content/#adding-static-content). +You can place the `swaggerui` shortcode anywhere inside a page with the [`swagger` layout](https://github.com/google/docsy/tree/main/layouts/swagger); it renders [Swagger UI](https://swagger.io/tools/swagger-ui/) using any OpenAPI YAML or JSON file as source. This file can be hosted anywhere you like, for example in your site's root [`/static` folder](/docs/adding-content/content/#adding-static-content). {{< tabpane persistLang=false >}} {{< tab header="Front matter:" disabled=true />}} From b6129aab23e8d546db71d7ecabed761a91b32f49 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri Benedetti Date: Fri, 5 May 2023 10:07:37 +0200 Subject: [PATCH 2/6] Remove old files --- layouts/shortcodes/swaggerui.html | 4 +- static/css/swagger-ui.css | 4 - static/js/swagger-ui-bundle.js | 134 ---------------------- static/js/swagger-ui-standalone-preset.js | 22 ---- 4 files changed, 2 insertions(+), 162 deletions(-) delete mode 100644 static/css/swagger-ui.css delete mode 100644 static/js/swagger-ui-bundle.js delete mode 100644 static/js/swagger-ui-standalone-preset.js diff --git a/layouts/shortcodes/swaggerui.html b/layouts/shortcodes/swaggerui.html index 0b582a1026..ea9b17c08b 100644 --- a/layouts/shortcodes/swaggerui.html +++ b/layouts/shortcodes/swaggerui.html @@ -1,10 +1,10 @@ {{ $original := .Get "src" }} -
+
- + + {{ block "main" . }}{{ end }} diff --git a/userguide/content/en/docs/adding-content/shortcodes/index.md b/userguide/content/en/docs/adding-content/shortcodes/index.md index 30b3e52198..84aaada5a5 100644 --- a/userguide/content/en/docs/adding-content/shortcodes/index.md +++ b/userguide/content/en/docs/adding-content/shortcodes/index.md @@ -284,8 +284,6 @@ description: Reference for the Pet Store API {{< /tab >}} {{< /tabpane >}} -You can customize Swagger UI's look and feel by overriding Swagger's CSS or by editing and compiling a [Swagger UI dist](https://github.com/swagger-api/swagger-ui) yourself and replace `themes/docsy/static/css/swagger-ui.css`. - ### redoc The `redoc` shortcode uses the open-source [Redoc](https://github.com/Redocly/redoc) tool to render reference API documentation from an OpenAPI YAML or JSON file. This can be hosted anywhere you like, for example in your site's root [`/static` folder](/docs/adding-content/content/#adding-static-content), but you can use a URL as well, for example: From 5f31dd2859f1f7f0359daccbf6e1aaf135e3caeb Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri Benedetti Date: Wed, 5 Jul 2023 16:49:49 +0200 Subject: [PATCH 4/6] Add swagger SCSS with fix --- assets/scss/_swagger.scss | 3 +++ assets/scss/main.scss | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 assets/scss/_swagger.scss diff --git a/assets/scss/_swagger.scss b/assets/scss/_swagger.scss new file mode 100644 index 0000000000..c504057ef3 --- /dev/null +++ b/assets/scss/_swagger.scss @@ -0,0 +1,3 @@ +.swagger-ui .info .title small pre { + background: #7d8492; +} \ No newline at end of file diff --git a/assets/scss/main.scss b/assets/scss/main.scss index 84bf68781a..4e5f482eca 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -34,6 +34,8 @@ @import "taxonomy"; @import "drawio"; @import "shortcodes"; +@import "swagger"; + @if $td-enable-google-fonts { @import url($web-font-path); From 9d100c46d31a2ff372d75feae8e1d342b09c50fd Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri Benedetti Date: Wed, 5 Jul 2023 16:54:57 +0200 Subject: [PATCH 5/6] Restore customization line --- userguide/content/en/docs/adding-content/shortcodes/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/userguide/content/en/docs/adding-content/shortcodes/index.md b/userguide/content/en/docs/adding-content/shortcodes/index.md index 84aaada5a5..573b3859ce 100644 --- a/userguide/content/en/docs/adding-content/shortcodes/index.md +++ b/userguide/content/en/docs/adding-content/shortcodes/index.md @@ -284,6 +284,8 @@ description: Reference for the Pet Store API {{< /tab >}} {{< /tabpane >}} +You can customize Swagger UI's look and feel by overriding Swagger's CSS in `themes/docsy/assets/scss/_swagger.scss`. + ### redoc The `redoc` shortcode uses the open-source [Redoc](https://github.com/Redocly/redoc) tool to render reference API documentation from an OpenAPI YAML or JSON file. This can be hosted anywhere you like, for example in your site's root [`/static` folder](/docs/adding-content/content/#adding-static-content), but you can use a URL as well, for example: From da41d54c4b16af1bada3ec26b337efcfe01042ec Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Tue, 11 Jul 2023 09:43:04 +0200 Subject: [PATCH 6/6] Add SRI hashes --- layouts/swagger/baseof.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/swagger/baseof.html b/layouts/swagger/baseof.html index 2d2391bae3..7a68c0c8e2 100644 --- a/layouts/swagger/baseof.html +++ b/layouts/swagger/baseof.html @@ -3,7 +3,7 @@ {{ partial "head.html" . }} {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }} - +
@@ -22,8 +22,8 @@
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }} - - + + {{ block "main" . }}{{ end }}