@scalar/hono-api-reference 0.8.8 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ app.get('/scalar', Scalar({
|
|
|
63
63
|
|
|
64
64
|
### Custom CDN
|
|
65
65
|
|
|
66
|
-
You can use a custom CDN
|
|
66
|
+
You can use a custom CDN, default is `https://cdn.jsdelivr.net/npm/@scalar/api-reference`.
|
|
67
67
|
|
|
68
68
|
You can also pin the CDN to a specific version by specifying it in the CDN string like `https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.28`
|
|
69
69
|
|
|
@@ -80,6 +80,54 @@ app.get('/scalar', Scalar({
|
|
|
80
80
|
}))
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
### Markdown for LLMs
|
|
84
|
+
|
|
85
|
+
If you want to create a Markdown version of the API reference (for LLMs), install `@scalar/openapi-to-markdown`:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm install @scalar/openapi-to-markdown
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
And add an additional route for it:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { Hono } from 'hono'
|
|
95
|
+
import { createMarkdownFromOpenApi } from '@scalar/openapi-to-markdown'
|
|
96
|
+
|
|
97
|
+
const app = new Hono()
|
|
98
|
+
|
|
99
|
+
// Generate Markdown from your OpenAPI document
|
|
100
|
+
const markdown = await createMarkdownFromOpenApi(content)
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Register a route to serve the Markdown for LLMs
|
|
104
|
+
*
|
|
105
|
+
* Q: Why /llms.txt?
|
|
106
|
+
* A: It's a proposal to standardise on using an /llms.txt file.
|
|
107
|
+
*
|
|
108
|
+
* @see https://llmstxt.org/
|
|
109
|
+
*/
|
|
110
|
+
app.get('/llms.txt', (c) => c.text(markdown))
|
|
111
|
+
|
|
112
|
+
export default app
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Or, if you are using Zod OpenAPI Hono:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
// Get the OpenAPI document
|
|
119
|
+
const content = app.getOpenAPI31Document({
|
|
120
|
+
openapi: '3.1.0',
|
|
121
|
+
info: { title: 'Example', version: 'v1' },
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const markdown = await createMarkdownFromOpenApi(JSON.stringify(content))
|
|
125
|
+
|
|
126
|
+
app.get('/llms.txt', async (c) => {
|
|
127
|
+
return c.text(markdown)
|
|
128
|
+
})
|
|
129
|
+
```
|
|
130
|
+
|
|
83
131
|
## Community
|
|
84
132
|
|
|
85
133
|
We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/scalar>
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "git+https://github.com/scalar/scalar.git",
|
|
11
11
|
"directory": "integrations/hono"
|
|
12
12
|
},
|
|
13
|
-
"version": "0.8.
|
|
13
|
+
"version": "0.8.10",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=18"
|
|
16
16
|
},
|
|
@@ -29,15 +29,16 @@
|
|
|
29
29
|
],
|
|
30
30
|
"module": "dist/index.js",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@scalar/core": "0.2.
|
|
32
|
+
"@scalar/core": "0.2.16"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@hono/node-server": "^1.11.0",
|
|
36
36
|
"@hono/zod-openapi": "^0.8.6",
|
|
37
37
|
"hono": "^4.6.5",
|
|
38
|
-
"vite": "
|
|
38
|
+
"vite": "5.4.19",
|
|
39
39
|
"vitest": "^1.6.0",
|
|
40
|
-
"@scalar/build-tooling": "0.1.19"
|
|
40
|
+
"@scalar/build-tooling": "0.1.19",
|
|
41
|
+
"@scalar/openapi-to-markdown": "0.1.0"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"hono": "^4.0.0"
|