Files
jupyterhub/docs/source/_templates/redoc.html
Min RK 0082f5b3da generate rest API with redoc
via custom template
2024-02-07 12:30:57 +01:00

35 lines
1.0 KiB
HTML

{%- extends "!layout.html" %}
{# not sure why, but theme CSS prevents scrolling within redoc content
# If this were fixed, we could keep the navbar and footer
#}
{%- block css %}{%- endblock %}
{%- block docs_navbar %}{%- endblock %}
{%- block footer %}{% endblock %}
{%- block body_tag %}
<body>
{%- endblock %}
{%- block extrahead %}
{{ super() }}
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700"
rel="stylesheet"
/>
<script src="{{ pathto('_static/redoc.js', 1) }}"></script>
{%- endblock %}
{%- block content %}
<redoc id="redoc-spec"></redoc>
<script>
if (location.protocol === "file:") {
document.body.innerText = "Rendered API specification doesn't work with file: protocol. Use sphinx-autobuild to do local builds of the docs, served over HTTP."
} else {
Redoc.init(
"{{ pathto('_static/rest-api.yml', 1) }}",
{{ meta.redoc_options | default({}) }},
document.getElementById("redoc-spec"),
);
}
</script>
{%- endblock %}