Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanThatOneKid committed Apr 5, 2024
1 parent 45a3a10 commit 29f5780
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check
"on":
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- name: Format
run: deno fmt && git diff-index --quiet HEAD
- name: Lint
run: deno lint && git diff-index --quiet HEAD
17 changes: 17 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish
"on":
push:
branches:
- main
workflow_dispatch: {}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- name: Publish package
run: deno publish
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"deno.enable": true,
"deno.unstable": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[markdown]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[jsonc]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[typescriptreact]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"files.eol": "\n"
}
83 changes: 81 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,81 @@
# htx
An HTML rendering library in JSX.
# [@fartlabs/htx](https://jsr.io/@fartlabs/htx)

[![GitHub Actions][GitHub Actions badge]][GitHub Actions]

Render HTML components with JSX.

## API documentation

Generated API documentation is available at <https://jsr.io/@fartlabs/htx>.

## Getting started

### Deno

Let's learn how to get started with rtx by creating a simple router in Deno.

1\. [Install Deno](https://docs.deno.com/runtime/manual).

2\. Start a new Deno project.

```sh
deno init
```

3\. Add `@fartlabs/jsonx` and `@fartlabs/htx` as project dependencies.

```sh
deno add @fartlabs/jsonx @fartlabs/htx
```

4\. Add the following values to your `deno.json(c)` file.

```json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@fartlabs/jsonx"
}
}
```

5\. Add a file ending in `.[j|t]sx` to your project. For example, `main.tsx`.

```tsx
import { a } from "@fartlabs/htx";

const html = <a href="https://example.com">Hello, world!</a>;

Deno.writeTextFileSync("index.html", html);
```

6\. Compile your HTML by running the `.[j|t]sx` file.

```sh
deno run --allow-net main.tsx
```

Resulting `index.html`:

```html
<a href="https://example.com">Hello, world!</a>
```

## Contribute

### Style

Run `deno fmt` to format the code.

Run `deno lint` to lint the code.

---

Developed with ❤️ [**@FartLabs**](https://github.com/FartLabs)

[JSR]: https://jsr.io/@fartlabs/htx
[JSR badge]: https://jsr.io/badges/@fartlabs/htx
[JSR score]: https://jsr.io/@fartlabs/htx/score
[JSR score badge]: https://jsr.io/badges/@fartlabs/htx/score
[GitHub Actions]: https://github.com/FartLabs/htx/actions/workflows/check.yaml
[GitHub Actions badge]: https://github.com/FartLabs/htx/actions/workflows/check.yaml/badge.svg
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 29f5780

Please sign in to comment.