mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
swagger: support leaf and page bundles #226
This commit is contained in:
parent
02cb15e0f4
commit
dd2233d93b
4 changed files with 16 additions and 4 deletions
|
@ -26,14 +26,20 @@ The `theme` setting can also be set by your used color variant. This will be the
|
|||
|
||||
## Usage
|
||||
|
||||
Just insert your Mermaid code in the `mermaid` shortcode like this:
|
||||
Just insert give the URL to your OpenAPI Specification like this:
|
||||
|
||||
````go
|
||||
{{</* swagger src="https://petstore3.swagger.io/api/v3/openapi.json" */>}}
|
||||
````
|
||||
|
||||
The `src` parameter is mandatory and can be either an absolute URL or a relative one pointing into your Hugo file system.
|
||||
If your page is a leaf or branch bundle, you can also use relative URLs:
|
||||
|
||||
````go
|
||||
{{</* swagger src="petstore.json" */>}}
|
||||
````
|
||||
|
||||
The `src` parameter is mandatory and can be either an absolute or a relative URL.
|
||||
|
||||
## Example
|
||||
|
||||
{{< swagger src="https://petstore3.swagger.io/api/v3/openapi.json" >}}
|
||||
{{< swagger src="petstore.json" >}}
|
1
exampleSite/content/shortcodes/swagger/petstore.json
Normal file
1
exampleSite/content/shortcodes/swagger/petstore.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,9 @@
|
|||
{{- $original := .Get "src" }}
|
||||
{{- with .Page.Resources.Match $original }}
|
||||
{{- range . }}
|
||||
{{- $original = .RelPermalink }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
<rapi-doc
|
||||
allow-spec-file-download="true"
|
||||
default-schema-tab="example"
|
||||
|
@ -9,7 +14,7 @@
|
|||
schema-description-expanded="true"
|
||||
schema-style="table"
|
||||
show-header="false"
|
||||
spec-url = "{{ $original | relURL }}"
|
||||
spec-url="{{ $original | relURL }}"
|
||||
sort-tags="true"
|
||||
></rapi-doc>
|
||||
{{- .Page.Store.Set "hasSwagger" true }}
|
Loading…
Reference in a new issue