diff --git a/demo/docusaurus.config.js b/demo/docusaurus.config.js index 1342b2cff..d4d5c2302 100644 --- a/demo/docusaurus.config.js +++ b/demo/docusaurus.config.js @@ -136,7 +136,7 @@ const config = { copyright: `Copyright © ${new Date().getFullYear()} Palo Alto Networks, Inc. Built with Docusaurus ${DOCUSAURUS_VERSION}.`, }, prism: { - additionalLanguages: ["ruby", "csharp", "php", "java"], + additionalLanguages: ["ruby", "csharp", "php", "java", "powershell"], }, languageTabs: [ { @@ -148,7 +148,7 @@ const config = { highlight: "python", language: "python", logoClass: "python", - variant: "http.client", + variant: "requests", }, { highlight: "go", @@ -161,28 +161,33 @@ const config = { logoClass: "nodejs", variant: "axios", }, - // { - // highlight: "ruby", - // language: "ruby", - // logoClass: "ruby", - // }, + { + highlight: "ruby", + language: "ruby", + logoClass: "ruby", + }, { highlight: "csharp", language: "csharp", logoClass: "csharp", variant: "httpclient", }, - // { - // highlight: "php", - // language: "php", - // logoClass: "php", - // }, + { + highlight: "php", + language: "php", + logoClass: "php", + }, { highlight: "java", language: "java", logoClass: "java", variant: "unirest", }, + { + highlight: "powershell", + language: "powershell", + logoClass: "powershell", + }, ], algolia: { apiKey: "441074cace987cbf4640c039ebed303c", @@ -233,7 +238,7 @@ const config = { template: "api.mustache", // Customize API MDX with mustache template downloadUrl: "https://raw.githubusercontent.com/PaloAltoNetworks/docusaurus-openapi-docs/main/demo/examples/petstore.yaml", - hideSendButton: true, + hideSendButton: false, }, cos: { specPath: "examples/openapi-cos.json", diff --git a/packages/docusaurus-theme-openapi-docs/package.json b/packages/docusaurus-theme-openapi-docs/package.json index 49d267ae0..c4fbca6b6 100644 --- a/packages/docusaurus-theme-openapi-docs/package.json +++ b/packages/docusaurus-theme-openapi-docs/package.json @@ -45,7 +45,7 @@ "dependencies": { "@docusaurus/theme-common": ">=2.0.1 <2.3.0", "@mdx-js/react": "^1.6.21", - "@paloaltonetworks/postman-code-generators": "^1.1.15", + "@paloaltonetworks/postman-code-generators": "1.1.15-patch.2", "@paloaltonetworks/postman-collection": "^4.1.0", "@reduxjs/toolkit": "^1.7.1", "buffer": "^6.0.3", diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/ApiDemoPanel/Curl/index.tsx b/packages/docusaurus-theme-openapi-docs/src/theme/ApiDemoPanel/Curl/index.tsx index 974cc43d5..eafaa89d6 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/ApiDemoPanel/Curl/index.tsx +++ b/packages/docusaurus-theme-openapi-docs/src/theme/ApiDemoPanel/Curl/index.tsx @@ -111,6 +111,16 @@ export const languageSet: Language[] = [ }, variant: "OkHttp", }, + { + highlight: "powershell", + language: "powershell", + logoClass: "powershell", + options: { + followRedirect: true, + trimRequestBody: true, + }, + variant: "RestMethod", + }, ]; export interface Props { @@ -280,7 +290,11 @@ function Curl({ postman, codeSamples }: Props) { } attributes={{ className: `code__tab--${lang.logoClass}` }} > - + {codeText} diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/styles.css b/packages/docusaurus-theme-openapi-docs/src/theme/styles.css index d552d2ff3..db4729241 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/styles.css +++ b/packages/docusaurus-theme-openapi-docs/src/theme/styles.css @@ -17,10 +17,16 @@ --openapi-card-border-radius: var(--ifm-pre-border-radius); --openapi-input-border: var(--ifm-color-primary); --openapi-input-background: var(--openapi-card-background-color); + --bash-background-color: transparent; + --bash-border-radius: none; + --code-tab-logo-width: 26px; + --code-tab-logo-height: 26px; } [data-theme="dark"] { --openapi-card-background-color: var(--ifm-color-gray-900) !important; + --bash-background-color: lightgrey; + --bash-border-radius: 20px; } .docs-wrapper { @@ -239,8 +245,8 @@ .code__tab--python::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/python/python-original.svg"); margin-block: auto; } @@ -265,8 +271,8 @@ .code__tab--go::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/go/go-original-wordmark.svg"); margin-block: auto; } @@ -291,8 +297,8 @@ .code__tab--javascript::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/javascript/javascript-original.svg"); margin-block: auto; } @@ -317,9 +323,11 @@ .code__tab--bash::after { content: ""; - width: 28px; - height: 28px; - background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/linux/linux-original.svg"); + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); + background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/bash/bash-plain.svg"); + background-color: var(--bash-background-color); + border-radius: var(--bash-border-radius); margin-block: auto; } @@ -343,8 +351,8 @@ .code__tab--ruby::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/ruby/ruby-plain.svg"); margin-block: auto; } @@ -369,8 +377,8 @@ .code__tab--csharp::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/csharp/csharp-original.svg"); margin-block: auto; } @@ -395,8 +403,8 @@ .code__tab--nodejs::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/nodejs/nodejs-original.svg"); margin-block: auto; } @@ -421,8 +429,8 @@ .code__tab--php::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/php/php-original.svg"); margin-block: auto; } @@ -447,8 +455,8 @@ .code__tab--java::after { content: ""; - width: 28px; - height: 28px; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/java/java-original.svg"); margin-block: auto; } @@ -471,6 +479,32 @@ overflow: auto; } +.code__tab--powershell::after { + content: ""; + width: var(--code-tab-logo-width); + height: var(--code-tab-logo-height); + background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/windows8/windows8-original.svg"); + margin-block: auto; +} + +.code__tab--powershell { + color: var(--ifm-color-info); + padding-left: 1.4rem; + padding-right: 1.4rem; + padding-top: 1rem !important; + padding-bottom: 1rem !important; +} + +.code__tab--powershell.tabs__item--active { + border-bottom-color: var(--ifm-color-info); + background-color: var(--ifm-color-emphasis-100); +} + +.language-powershell { + max-height: 500px; + overflow: auto; +} + /* Prism code styles */ .prism-code.language-java { white-space: pre !important; diff --git a/yarn.lock b/yarn.lock index 2cfce3e28..09e9d5471 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3101,10 +3101,10 @@ path-browserify "1.0.1" yaml "1.10.2" -"@paloaltonetworks/postman-code-generators@^1.1.15": - version "1.1.15" - resolved "https://registry.yarnpkg.com/@paloaltonetworks/postman-code-generators/-/postman-code-generators-1.1.15.tgz#822eb45b538e47559ef2b6552223923cd8a62571" - integrity sha512-GVVqC+Uhe5Bt6VH/j26ooYZhv3lnrTdx59Fj3/DNeHV3aJAaWFtktu9pqj90nbxR56Sg/3CymaoZl/vyLiLJmg== +"@paloaltonetworks/postman-code-generators@1.1.15-patch.2": + version "1.1.15-patch.2" + resolved "https://registry.yarnpkg.com/@paloaltonetworks/postman-code-generators/-/postman-code-generators-1.1.15-patch.2.tgz#012051485269a2da6bd9a6b60031ddbc53e5e363" + integrity sha512-tRnAKtV4M8wLxcVnAx6ZCjCqbrR1xiqJNQkf1A71K8UxEP3N/+EspT82N5c0555w02oYFk21ViHuzuhm4gaGLw== dependencies: "@paloaltonetworks/postman-collection" "^4.1.0" async "^3.2.4"