Skip to content

Commit 47e24ce

Browse files
committed
📘 feat: use shiki in openapi block
1 parent 27a02d3 commit 47e24ce

File tree

3 files changed

+25
-31
lines changed

3 files changed

+25
-31
lines changed

‎components/midori/index.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ const isDark = useDark()
5555
<TypeStrict>
5656
<slot name="typestrict"></slot>
5757
</TypeStrict>
58-
<OpenAPI />
58+
<OpenAPI>
59+
<slot name="openapi"></slot>
60+
</OpenAPI>
5961
</section>
6062
<E2ETypeSafety />
6163
<Plugins />
@@ -80,7 +82,7 @@ const isDark = useDark()
8082
width: -moz-fit-content;
8183
width: fit-content;
8284
min-width: 100%;
83-
line-height: var(--vp-code-line-height);
85+
line-height: 1.5rem;
8486
font-size: var(--vp-code-font-size);
8587
color: var(--vp-code-block-color);
8688
transition: color 0.5s;

‎components/midori/openapi.vue

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,18 @@
1-
<script setup lang="ts">
2-
import Prism from 'vue-prism-component'
3-
4-
const code = `import { Elysia, t } from 'elysia'
5-
import { swagger } from '@elysiajs/swagger'
6-
import { users, feed } from './controllers'
7-
8-
new Elysia()
9-
.use(swagger())
10-
.use(users)
11-
.use(feed)
12-
.listen(3000)`
13-
</script>
14-
151
<template>
16-
<article
17-
class="flex flex-col-reverse md:flex-row justify-between items-center gap-4 md:gap-12 w-full max-w-6xl"
18-
>
19-
<section class="w-full">
20-
<Prism class="!text-base !font-mono rounded-xl" language="typescript">
21-
{{ code }}
22-
</Prism>
2+
<article class="flex flex-col-reverse md:flex-row justify-between items-center gap-4 md:gap-12 w-full max-w-6xl">
3+
<section class="w-full !text-base !font-mono rounded-xl">
4+
<slot></slot>
235
</section>
246
<header class="flex flex-col gap-3 w-full">
257
<h3
26-
class="text-5xl leading-tight font-bold text-transparent bg-clip-text bg-gradient-to-br from-teal-300 to-blue-300"
27-
>
8+
class="text-5xl leading-tight font-bold text-transparent bg-clip-text bg-gradient-to-br from-teal-300 to-blue-300">
289
OpenAPI / Swagger
2910
</h3>
30-
<p
31-
class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4"
32-
>
11+
<p class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4">
3312
Elysia generates OpenAPI 3.0 specs automatically to integrate
3413
with various tools across multiple languages
3514
</p>
36-
<p
37-
class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4"
38-
>
15+
<p class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4">
3916
Thanks to OpenAPI compliance, Elysia can generate Swagger in one
4017
line with the Swagger plugin.
4118
</p>

‎docs/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ new Elysia()
5454
)
5555
.listen(3000)
5656

57+
```
58+
</template>
59+
60+
<template v-slot:openapi>
61+
62+
```ts
63+
import { Elysia, t } from 'elysia'
64+
import { swagger } from '@elysiajs/swagger'
65+
import { users, feed } from './controllers'
66+
67+
new Elysia()
68+
.use(swagger())
69+
.use(users)
70+
.use(feed)
71+
.listen(3000)
5772
```
5873
</template>
5974
</Landing>

0 commit comments

Comments
 (0)