@@ -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
810npm 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
4850The ` 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
5254npx doc-kit generate \
@@ -65,21 +67,67 @@ npx doc-kit generate -t web -t orama-db -i "docs/*.md" -o out
6567
6668The ` web ` output uses import maps and client-side hydration, so it must be
6769served 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
7476Then open the printed URL (usually < http://localhost:3000 > ). The
7577` legacy-html-all ` output from earlier has no such requirement — ` out/all.html `
7678opens 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.
0 commit comments