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
Docusaurus site for the HAAPI React SDK. Most content is **generated** from the SDK source, so you rarely
4
-
edit pages by hand — you edit the SDK (README + TSDoc) and the example files, and the build assembles the site.
3
+
Docusaurus site for the HAAPI React SDK. Almost all content is **generated** from the SDK source: you
4
+
edit the SDK (`README.md` + component TSDoc) and the example files, and the build assembles the site.
5
+
You rarely touch pages by hand.
5
6
6
7
## Run it
7
8
@@ -11,49 +12,33 @@ npm run docs:build # production build (fails on broken links)
11
12
```
12
13
13
14
Both run the generators first (`predocs`): `docs:gen → docs:split → docs:apiref → docs:examples`.
15
+
Everything they emit lands in **`content/`**, which is gitignored — never edit it, change the source.
14
16
15
17
## Where content comes from
16
18
17
19
| Sidebar section | Source | How |
18
20
|---|---|---|
19
-
|**Overview**| SDK `README.md`|`docs:gen` → `_overview.mdx`, `docs:split` → one page per `##`|
20
-
|**API Reference**| component **TSDoc**|`docs:apiref` extracts the TSDoc (`scripts/extract-tsdoc.mjs`) and emits a Markdown page per entry in `api-reference.entries.mjs`|
21
+
|**Overview**| SDK `README.md`|`docs:gen` → `content/_overview.mdx`, `docs:split` → one page per `##`|
22
+
|**API Reference**| component **TSDoc**|`docs:apiref` extracts the TSDoc and emits a Markdown page per entry in `api-reference.entries.mjs`|
21
23
|**Examples**|`examples/*.tsx`|`docs:examples` emits a playground page per entry in `examples.entries.mjs`|
22
24
23
-
Generated folders (`docs/_overview.mdx`, `docs/overview/`, `docs/api-reference/`, `docs/examples/`) are
24
-
**gitignored** — don't edit them; change the source instead.
25
+
## Examples are live playgrounds
25
26
26
-
## Examples = live playgrounds
27
+
Each `examples/<Name>.tsx` is a self-contained app (a default `App` wrapped in `<ExamplePreviewer>`) that
28
+
runs **live** in the docs against a mocked HAAPI backend — readers can edit the code and see it update.
27
29
28
-
An example is a self-contained `examples/<Name>.tsx` (default `App`, wrapped in `<ExamplePreviewer>`).
29
-
`docs:gen` bundles every example into `examples.json` (keyed by basename). You reference it by **name**
30
-
(its filename, no `.tsx`) in one of two ways — both get rewritten, at generation time, into the same
31
-
`<DocExample id="<Name>" />` runtime tag, which looks the source up in `examples.json` by that `id`:
30
+
To show an example on a page, reference its file in any of these ways:
32
31
33
-
-**A markdown link to the file** — `[label](…/examples/<Name>.tsx)`, in the SDK `README.md` (→ Overview).
34
-
It stays a clickable link on GitHub; the build derives `<Name>` from the link and converts it to a
35
-
playground (`build-sandpack-sdk.mjs`).
36
-
-**A `{@see_example docs/examples/<Name>.tsx Label}` marker** — inside a component's TSDoc, so the
37
-
playground renders inline on its API Reference page (`emit-api-reference.mjs`).
38
-
39
-
(The Examples section pages are emitted from `examples.entries.mjs`. You don't hand-write `<DocExample>` —
40
-
it's the generated tag underlying all of these.) Each mounts the example in Sandpack against the **mocked**
41
-
HAAPI driver (no backend) using the shared closure in `src/sandpack/closure.ts`.
0 commit comments