Skip to content

Commit c9e10b8

Browse files
committed
feat: index.html in examples
1 parent 7ad3b8b commit c9e10b8

3 files changed

Lines changed: 65 additions & 0 deletions

File tree

69 Bytes
Binary file not shown.

examples/fastapi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,6 @@ def post_foo(a: str):
6767
def get_docs():
6868
docs_html = docs.to_html()
6969
return responses.HTMLResponse(docs_html)
70+
71+
72+
docs.to_file("index.html")

examples/index.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Scalar API Docs</title>
7+
<link rel="shortcut icon" href="https://www.python.org/static/apple-touch-icon-144x144-precomposed.png">
8+
<meta name="theme-color" content="#FFD43B">
9+
<style>
10+
body { margin: 0; padding: 0; }
11+
api-reference { height: 100vh; display: block; }
12+
.introduction-description-heading { margin-top: 5em !important; }
13+
.dark-mode .light-only { display: none; }
14+
.light-mode .light-only { display: inherit; }
15+
.light-mode .dark-only { display: none; }
16+
.dark-mode .dark-only { display: inherit; }
17+
.light-mode {
18+
--scalar-color-1: #0c2344;
19+
--scalar-color-2: #4B6EAF;
20+
--scalar-color-3: #FFD43B;
21+
--scalar-background-1: #ffffff;
22+
--scalar-background-2: #f5f5f5;
23+
--scalar-background-3: #e0e0e0;
24+
--scalar-color-accent: #306998;
25+
--scalar-background-accent: #dbe9f7;
26+
--scalar-link-color: #1c6cc7;
27+
code { color: #2f4f4f; }
28+
}
29+
.dark-mode {
30+
--scalar-color-1: #ffffff;
31+
--scalar-color-2: #aaaaaa;
32+
--scalar-color-3: #FFD43B;
33+
--scalar-background-1: #0a0a0a;
34+
--scalar-background-2: #111111;
35+
--scalar-background-3: #1a1a1a;
36+
--scalar-color-accent: #FFD43B;
37+
--scalar-background-accent: #ffd43b33;
38+
--scalar-link-color: #FFD43B;
39+
code { color: #f0f0f0; }
40+
}
41+
</style>
42+
</head>
43+
<body>
44+
<style>
45+
:root { --scalar-custom-header-height: 64px; }
46+
.custom-header { height: var(--scalar-custom-header-height); backdrop-filter: blur(5px); display: flex; justify-content: space-between; align-items: center; padding: 0 18px; position: sticky; top: 0; z-index: 100; box-shadow: inset 0 -1px 0 var(--scalar-border-color); background: transparent; color: var(--scalar-color-1); font-size: var(--scalar-font-size-2); }
47+
.custom-header nav { display: flex; gap: 18px; }
48+
.custom-header a:hover { color: var(--scalar-color-2); }
49+
</style>
50+
<header class="custom-header scalar-app">
51+
<div style="padding: 16px;">
52+
<img class="light-only" src="https://upload.wikimedia.org/wikipedia/commons/c/c3/Python-logo-notext.svg" style="max-height:24px;">
53+
<img class="dark-only" src="https://upload.wikimedia.org/wikipedia/commons/c/c3/Python-logo-notext.svg" style="max-height:24px;">
54+
</div>
55+
<nav><ul><li><a target="_blank" href="https://www.python.org">Python.org</a></li></ul></nav>
56+
</header>
57+
58+
<script id="api-reference" data-url="/openapi.json"></script>
59+
<script>document.getElementById('api-reference').dataset.configuration = '{"hideInternal": false, "hideDownloadButton": false, "showSidebar": true, "showWebhooks": true, "showExamples": true, "authPersist": false, "expandAuthentication": false, "expandTableOfContents": false, "darkModeInvertColors": false, "enableSearch": true, "persistAuth": false, "showModels": true, "tryIt": true, "showErrors": true, "showExport": false, "expandResponses": false}';</script>
60+
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
61+
</body>
62+
</html>

0 commit comments

Comments
 (0)