You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains the code for the Tour of JSON Schema project.
4
-
https://tour.json-schema.org
3
+
Welcome to the **Tour of JSON Schema** project! This repository hosts the codebase for an interactive learning platform designed to help users understand and master JSON Schema. You can access the live version of the project at [https://tour.json-schema.org](https://tour.json-schema.org).
5
4
6
-
# Development
5
+
---
7
6
8
-
The project is built using next.js.
7
+
## Table of Contents
9
8
10
-
After cloning the repository, run the following command to install the dependencies:
9
+
-[Tour of JSON Schema](#tour-of-json-schema)
10
+
-[Table of Contents](#table-of-contents)
11
+
-[Development Setup](#development-setup)
12
+
-[Prerequisites](#prerequisites)
13
+
-[Installation](#installation)
14
+
-[Content Creation](#content-creation)
15
+
-[Writing MDX](#writing-mdx)
16
+
-[VSCode Extensions](#vscode-extensions)
17
+
-[File Structure](#file-structure)
18
+
-[MDX Components Guide](#mdx-components-guide)
19
+
-[GoodToKnowBox](#goodtoknowbox)
20
+
-[CodeSnippet](#codesnippet)
21
+
-[SideEditorLink](#sideeditorlink)
22
+
-[Contributing](#contributing)
11
23
12
-
```bash
13
-
pnpm install
14
-
```
24
+
---
15
25
16
-
To start the development server, run the following command:
26
+
## Development Setup
17
27
18
-
```bash
19
-
pnpm dev
20
-
```
28
+
The project is built using **Next.js**, a React framework for building server-rendered applications. Below are the steps to set up your development environment:
21
29
22
-
> when you run `pnpm dev`, a file named `outline.json` will be created in th `/content` directory. This file is used to generate the table of contents for the website.
30
+
### Prerequisites
23
31
24
-
(make sure you run tests before pushing your changes)
25
-
To run the tests, run the following command:
32
+
-**Node.js**: Ensure you have Node.js installed (v16 or higher).
33
+
-**pnpm**: The project uses `pnpm` as the package manager.
The content written in [MDX](https://mdxjs.com/), a markdown format that supports JSX syntax. This allows us to embed React components in the docs. See the [GitHub Markdown Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for a quick overview of markdown syntax.
53
+
> **Note**: Running `pnpm dev` will generate a file named `outline.json`in the `/content` directory. This file is used to dynamically generate the table of contents for the website.
37
54
38
-
### VSCode
55
+
4. Run tests before pushing changes:
56
+
```bash
57
+
pnpm test
58
+
```
39
59
40
-
#### Extensions
60
+
---
41
61
42
-
We recommend the following extensions for VSCode users:
62
+
## Content Creation
43
63
44
-
-[MDX](https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx): Intellisense and syntax highlighting for MDX.
45
-
-[Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode): Format MDX files on save.
64
+
The content for the Tour of JSON Schema is written in **MDX**, a markdown format that supports JSX syntax. This allows us to embed React components directly into the documentation, making it highly interactive and engaging.
46
65
47
-
##File Structure
66
+
### Writing MDX
48
67
49
-
the content of each step is stored in the `/content` directory with the following structure:
68
+
MDX combines the simplicity of Markdown with the power of React. Here are some resources to get started:
The content is organized in the `/content` directory with the following structure:
84
+
85
+
```
53
86
├── 01-introduction
54
-
│ ├── index.mdx
87
+
│ ├── index.mdx # Overview of the section
55
88
│ ├── 01-welcome
56
-
│ ├── instructions.mdx
57
-
│ ├── code.ts
89
+
│ ├── instructions.mdx # Instructions for the step
90
+
│ ├── code.ts # Template code and validation logic
58
91
│ ├── 02-what-is-json-schema
59
92
│ ├── instructions.mdx
60
93
│ ├── code.ts
@@ -66,54 +99,88 @@ the content of each step is stored in the `/content` directory with the followin
66
99
│ ├── 02-arrays
67
100
│ ├── instructions.mdx
68
101
│ ├── code.ts
69
-
70
102
```
71
103
72
-
The instructions.mdx file holds the content the users sees, and the code.ts file holds template code and the logic to validate user provided schemas
104
+
- Each section (e.g., `01-introduction`) has an `index.mdx` file that serves as an overview.
105
+
- Each step within a section contains:
106
+
-`instructions.mdx`: The content displayed to the user.
107
+
-`code.ts`: Contains template code and logic to validate user-provided schemas.
108
+
109
+
---
73
110
74
111
## MDX Components Guide
75
112
76
-
### GoodToKnowBox
113
+
The project includes custom React components to enhance the interactivity and readability of the content. Below is a guide to the available components:
114
+
115
+
### GoodToKnowBox
77
116
78
-
A box that displays a tipsor any messages in a box.
117
+
A styled box for displaying tips, notes, or additional information.
79
118
80
119
**Props:**
81
-
-`title`: The title of the box (default: "Good to know")
82
-
-`children`: The content of the box
120
+
-`title` (optional): The title of the box. Defaults to "Good to know".
121
+
-`children`: The content of the box.
83
122
84
123
**Example:**
85
124
```md
86
-
<GoodToKnowBox title="Tips">
87
-
This is a good to know box
125
+
<GoodToKnowBox title="Pro Tip">
126
+
Use `$ref` to reuse schema definitions and keep your JSON Schema DRY.
88
127
</GoodToKnowBox>
89
128
```
129
+
130
+
---
131
+
90
132
### CodeSnippet
91
133
92
-
A code block that displays the code with syntax highlighting.
134
+
A code block with syntax highlighting and optional line highlighting.
93
135
94
136
**Props:**
95
-
-`highlightLineStart`: The line number to start highlighting
96
-
-`highlightLineEnd`: The line number to end highlighting (default: highlight only one line)
97
-
-`startingLineNumber`: The starting line number of the code block (default: 1)
98
-
-`showLineNumbers`: Whether to show line numbers (default: true)
137
+
-`highlightLineStart`: The starting line number to highlight.
138
+
-`highlightLineEnd` (optional): The ending line number to highlight. Defaults to `highlightLineStart`.
139
+
-`startingLineNumber` (optional): The starting line number for the code block. Defaults to `1`.
140
+
-`showLineNumbers` (optional): Whether to display line numbers. Defaults to `true`.
0 commit comments