-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18020d5
commit ef56f80
Showing
13 changed files
with
152 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,81 @@ | ||
--- | ||
title: Getting Started | ||
title: Getting started | ||
--- | ||
|
||
# Getting Started | ||
|
||
Get started with jsonx by following the steps below. | ||
|
||
## Install | ||
|
||
Install as usual via NPM: | ||
|
||
```shell | ||
npx jsr add @fartlabs/jsonx | ||
``` | ||
|
||
Or if you're using Deno: | ||
|
||
```shell | ||
deno add @fartlabs/jsonx | ||
``` | ||
|
||
Add the following values to your `deno.json(c)` file. | ||
|
||
```json | ||
{ | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"jsxFactory": "@fartlabs/jsonx" | ||
} | ||
} | ||
``` | ||
|
||
## Use | ||
|
||
Add a file ending in `.[j|t]sx` to your project. For example, `example.tsx`. | ||
|
||
```tsx | ||
function Cat() { | ||
return { animals: ["🐈"] }; | ||
} | ||
|
||
function Dog() { | ||
return { animals: ["🐕"] }; | ||
} | ||
|
||
const data = ( | ||
<> | ||
<Cat /> | ||
<Dog /> | ||
</> | ||
); | ||
|
||
Deno.writeTextFileSync( | ||
"data.json", | ||
JSON.stringify(data, null, 2), | ||
); | ||
``` | ||
|
||
Compile your jsonx by running the `.[j|t]sx` file. | ||
|
||
```shell | ||
deno run --allow-write example.tsx | ||
``` | ||
|
||
Preview the `data.json` file. | ||
|
||
```shell | ||
cat data.json | ||
``` | ||
|
||
Resulting `data.json`: | ||
|
||
```json | ||
{ | ||
"animals": [ | ||
"🐈", | ||
"🐕" | ||
] | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
title: New playground | ||
href: /playgrounds | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: JSX | ||
--- | ||
|
||
# JSX | ||
|
||
> [!NOTE] | ||
> | ||
> Coming soon. | ||
[Learn why jsonx uses JS](/03_jsx/01_theory.md). | ||
|
||
### Why does jsonx use JSX? | ||
|
||
> [!NOTE] | ||
> | ||
> Coming soon. | ||
## Syntax | ||
|
||
> [!NOTE] | ||
> | ||
> Coming soon. | ||
## Project setup | ||
|
||
> [!NOTE] | ||
> | ||
> Coming soon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: Theory | ||
--- | ||
|
||
# Theory of JSX | ||
|
||
> [!NOTE] | ||
> | ||
> Coming soon. | ||
## Why does jsonx use JSX? | ||
|
||
> [!NOTE] | ||
> | ||
> Coming soon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: Examples | ||
--- | ||
|
||
# Examples | ||
|
||
> [!NOTE] | ||
> | ||
> More examples coming soon. | ||
Learn how to use jsonx in practical situations. | ||
|
||
- [Hello world↩](/04_examples/01_hello) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Hello world | ||
playground: example:01_animals.tsx | ||
--- | ||
|
||
# Hello world | ||
|
||
This example demonstrates how to use jsonx to create a simple JSON object. | ||
|
||
Press the "Play" button to run the code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters