Skip to content

Commit 9522abb

Browse files
docs: link docs url
1 parent cd4c846 commit 9522abb

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

README.md

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
11
# @elysiajs/html
2-
Plugin for [elysia](https://github.com/elysiajs/elysia) that add support for returning html.
3-
4-
## Installation
5-
```bash
6-
bun add @elysiajs/html
7-
```
8-
9-
## Example
10-
```typescript
11-
import { Elysia } from 'elysia'
12-
import { html } from '@elysiajs/html'
132

14-
const page = `<!DOCTYPE HTML>
15-
<html lang="en">
16-
<head>
17-
<title>Hello World</title>
18-
</head>
19-
<body>
20-
<h1>Hello World</h1>
21-
</body>
22-
</html>`
23-
24-
const app = new Elysia()
25-
.use(html())
26-
.get('/', () => page)
27-
.get('/html', ({ html }) => html(page))
28-
.listen(8080)
29-
```
3+
Plugin for [elysia](https://github.com/elysiajs/elysia) that add support for returning html.
304

31-
## API
32-
This plugin detects HTML string and adds `html` method to `Context`.
5+
<br />
336

34-
If your response is start with `<!DOCTYPE` (case insensitive), `Content-Type` will be set to `text/html`.
7+
<h3 align=center>
8+
Documentation at <a href="https://elysiajs.com/plugins/html.html">elysiajs.com/plugins/html</a>
9+
</h3>
3510

36-
Or if you want to manually return HTML, simply use the newly added `html` function like this:
37-
```typescript
38-
app.get('/html', ({ html }) => html(page))
39-
```
11+
<br />

0 commit comments

Comments
 (0)