Skip to content

Commit 82e80ef

Browse files
committed
improve documentation based on feedback
1 parent 9426ef2 commit 82e80ef

2 files changed

Lines changed: 74 additions & 24 deletions

File tree

www/pages/getting-started.md

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This page takes you from an empty directory to a rendered documentation page.
44

55
## Install
66

7+
From an initialized npm project, run this in your terminal.
8+
79
```bash
810
npm install --save-dev @node-core/doc-kit
911
```
@@ -41,12 +43,12 @@ npx doc-kit generate \
4143
-o out
4244
```
4345

44-
Open `out/all.html`.
46+
Open `out/all.html` in a browser. You'll notice the Node.js branding.
4547

4648
## Render the modern site
4749

4850
The `web` target produces the server-rendered, client-hydrated site that
49-
nodejs.org uses — and that this site is built with:
51+
[nodejs.org](https://nodejs.org) uses — and that this site is built with:
5052

5153
```bash
5254
npx doc-kit generate \
@@ -65,21 +67,67 @@ npx doc-kit generate -t web -t orama-db -i "docs/*.md" -o out
6567

6668
The `web` output uses import maps and client-side hydration, so it must be
6769
served over HTTP — opening the files directly with `file://` will not work. Any
68-
static server does; for example:
70+
static server will do the trick; for example:
6971

7072
```bash
71-
npx serve out
73+
npx serve out -p 3000
7274
```
7375

7476
Then open the printed URL (usually <http://localhost:3000>). The
7577
`legacy-html-all` output from earlier has no such requirement — `out/all.html`
7678
opens straight from disk.
7779

80+
## Customize the `web` generator output
81+
82+
The power of the `web` generator comes from its customization hooks. Let's walk
83+
through a couple quick changes.
84+
85+
Create a `doc-kit.config.mjs` file at the root of the project.
86+
87+
```json
88+
import { join } from 'node:path';
89+
90+
/** @type {import('@node-core/doc-kit/src/utils/configuration/types').Configuration} */
91+
export default {
92+
web: {
93+
project: "My Project", // Project name used in page titles and the version selector
94+
remoteConfigUrl: "", // Suppress the Node.js default that sets the top banner based on Node.js news.
95+
head: {
96+
html: [
97+
// re-write the brand color for effect
98+
`<style>
99+
:root {
100+
--color-brand-100: #f7f1fb;
101+
--color-brand-200: #ead9fb;
102+
--color-brand-300: #dbbdf9;
103+
--color-brand-400: #c79bf2;
104+
--color-brand-600: #9756d6;
105+
--color-brand-700: #7d3cbe;
106+
--color-brand-800: #642b9e;
107+
--color-brand-900: #361b52;
108+
}
109+
</style>`,
110+
],
111+
},
112+
// use a custom logo instead of the Node.js logo
113+
// our logo.jsx file like this, just for the demo
114+
// export default Logo = () =>
115+
// <svg height="30" width="30" viewBox="0 0 10 10"><circle cx="5" cy="5" r="5" fill="var(--color-brand-400)"/></svg>;
116+
imports: {
117+
"#theme/Logo": join(import.meta.dirname, './logo.jsx'),
118+
},
119+
},
120+
};
121+
```
122+
123+
Re-build the project, serve, and you'll see how quickly you can change the
124+
experience, preserving core functionality.
125+
78126
## Next steps
79127

80-
- [Configuration](./configuration.html)move these flags into
81-
`doc-kit.config.mjs`.
82-
- [Customize the `web` generator](./generator-web.html)theming, `head`, and
83-
custom templating
84-
- [Read the full input specification](./specification.html) — the full Markdown
128+
- Explore [Configuration](./configuration)consider moving your `-t` target
129+
flags into a `doc-kit.config.mjs` file.
130+
- [Further customize the `web` generator](./generator-web)check out more
131+
customization options
132+
- [Read the full input specification](./specification) — the full Markdown
85133
contract. components.

www/pages/index.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
# doc-kit
1+
# `doc-kit`
22

3-
doc-kit is not a general-purpose Markdown-to-output tool to structurally
4-
transform API documentation.
5-
6-
`@node-core/doc-kit` is the documentation toolchain behind the Node.js API
3+
`doc-kit` is an opinionated Markdown parsing tool to structurally transform API
4+
documentation. It;s the documentation toolchain behind the Node.js API
75
reference, found at https://nodejs.org/docs/latest/api/. This site is built by
8-
doc-kit, from its own repository. The pages you are reading were produced by the
9-
`web` generator.
6+
`doc-kit`, from its own repository. The pages you are reading were produced by
7+
the `web` generator.
8+
9+
> 📣 `doc-kit` is in beta. We'd like feedback within the
10+
> [issue log](https://github.com/nodejs/doc-kit/issues) or by visiting the
11+
> [#nodejs-website Slack Channel](https://openjs-foundation.slack.com/archives/CVAMEJ4UV).
1012
1113
## `doc-kit` is a pipeline, not a Markdown converter
1214

13-
doc-kit parses Markdown source files once, emitting output according to
15+
`doc-kit` parses Markdown source files once, emitting output according to
1416
configured generators. You run any subset of them in one command, customize
1517
their logic, or even build your own generator.
1618

@@ -36,7 +38,7 @@ Only some of these are things you ask for by name. `ast`, `metadata`, and
3638
them, and they are not valid `-t` targets. Everything in the fan-out below
3739
`metadata` is a target you can pass to `-t`, and passing several at once reuses
3840
the one shared parse rather than repeating it. The full list is in the
39-
[generators reference](./generator-web.html).
41+
[generators reference](./generator-web).
4042

4143
## The input contract
4244

@@ -48,11 +50,11 @@ important rule:
4850
> page's identity — its sidebar label and its output filename. A file without
4951
> one produces no page at all, and the build still exits `0`.
5052
51-
See [the specification](./specification.html) for the full input format.
53+
See [the specification](./specification) for the full input format.
5254

53-
## Start here
55+
## What's next
5456

55-
- [Getting started](./getting-started.html) — render your first document.
56-
- [Commands](./commands.html) — the `doc-kit` CLI surface.
57-
- [Configuration](./configuration.html)`doc-kit.config.mjs` reference.
58-
- [Creating generators](./generators.html) — extend the pipeline.
57+
- [Getting started](./getting-started) — render your first document.
58+
- [Commands](./commands) — the `doc-kit` CLI surface.
59+
- [Configuration](./configuration)`doc-kit.config.mjs` reference.
60+
- [Creating generators](./generators) — extend the pipeline.

0 commit comments

Comments
 (0)