forked from Kong/spec-renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb-component.html
More file actions
48 lines (44 loc) · 1.74 KB
/
Copy pathweb-component.html
File metadata and controls
48 lines (44 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="${description}" />
<title>Kong Spec Renderer</title>
<!-- Include Kong Spec Renderer styles for content teleported out of web component. -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@kong/spec-renderer@^1/dist/spec-renderer.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"
rel="stylesheet">
<style>
html,
body {
padding: 0;
margin: 0;
height: 100%;
}
body {
font-family: 'Inter', Roboto, Helvetica, sans-serif;
}
</style>
</head>
<body>
<kong-spec-renderer show-powered-by="true" hide-insomnia-try-it="true" navigation-type="hash"
spec-url="https://raw.githubusercontent.com/Kong/spec-renderer/refs/heads/main/sandbox/public/specs/kong-air.json" />
<script type="module">
import { registerKongSpecRenderer } from 'https://cdn.jsdelivr.net/npm/@kong/spec-renderer@^1/dist/kong-spec-renderer.web-component.es.js'
// Check if hash exists and set current-path
const hash = window.location.hash;
if (hash) {
const path = hash.substring(1); // Remove the # character
const renderer = document.querySelector('kong-spec-renderer');
if (renderer) {
renderer.setAttribute('current-path', path);
}
}
registerKongSpecRenderer()
</script>
</body>
</html>