docpensieve 0.5.0-beta.3 → 0.5.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/commands/init.js +4 -0
- package/src/server.js +15 -11
- package/starter/01-guide/05-themes.mdx +4 -2
- package/starter/01-guide/06-deployment.md +38 -0
- package/starter/01-guide/07-migrate-to-beta.md +13 -0
- package/starter/01-guide/10-languages.md +17 -0
- package/starter/02-components/01-card.mdx +22 -0
- package/starter/02-components/02-columns.mdx +12 -0
- package/starter/02-components/03-time-timer.mdx +24 -0
- package/starter/02-components/04-tooltip.mdx +9 -0
- package/starter/02-components/05-tree.mdx +13 -0
- package/starter/02-components/06-scroll-to-top.mdx +10 -0
- package/starter/02-components/07-skill.mdx +16 -0
- package/starter/02-components/08-logo-icon.mdx +10 -0
- package/starter/02-components/09-for-theme.mdx +6 -0
- package/starter/02-components/10-cards.mdx +9 -0
- package/starter/02-components/11-menu.mdx +22 -0
- package/starter/02-components/12-admonition.mdx +9 -0
- package/starter/03-reference/02-configuration.md +33 -0
- package/starter/03-reference/05-api.md +49 -0
- package/starter/05-whats-new.md +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docpensieve",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.5",
|
|
4
4
|
"description": "DocPensieve command-line interface (init, build, check, dev, serve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"types"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@docpensieve/components": "0.5.0-beta.
|
|
28
|
-
"@docpensieve/core": "0.5.0-beta.
|
|
29
|
-
"@docpensieve/shared": "0.5.0-beta.
|
|
30
|
-
"@docpensieve/theme": "0.5.0-beta.
|
|
27
|
+
"@docpensieve/components": "0.5.0-beta.5",
|
|
28
|
+
"@docpensieve/core": "0.5.0-beta.5",
|
|
29
|
+
"@docpensieve/shared": "0.5.0-beta.5",
|
|
30
|
+
"@docpensieve/theme": "0.5.0-beta.5",
|
|
31
31
|
"chalk": "^6.0.0",
|
|
32
32
|
"chokidar": "^5.0.0",
|
|
33
33
|
"commander": "^15.0.0"
|
package/src/commands/init.js
CHANGED
|
@@ -399,6 +399,10 @@ function renderConfig({ name, theme, siteUrl, version, translation = '' }) {
|
|
|
399
399
|
' // A search field in the header, and a search page built with the site.',
|
|
400
400
|
' // Content pages load no script: the search page alone does.',
|
|
401
401
|
' search: true,',
|
|
402
|
+
'',
|
|
403
|
+
' // llms.txt at the root of the site, and a Markdown copy beside each',
|
|
404
|
+
' // page: what a program reads instead of the HTML. It needs no siteUrl.',
|
|
405
|
+
' llms: false,',
|
|
402
406
|
'};',
|
|
403
407
|
'',
|
|
404
408
|
'// Every field is described in the reference of the DocPensieve documentation:',
|
package/src/server.js
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* @module docpensieve/server
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { stat } from 'node:fs/promises';
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
9
8
|
import { createServer } from 'node:http';
|
|
10
9
|
import path from 'node:path';
|
|
11
10
|
|
|
@@ -134,9 +133,15 @@ export function createStaticServer({ root, basePath = '/', inject = null, onRelo
|
|
|
134
133
|
return;
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
// Read whole, then answer. `dev` empties the version folder at every
|
|
137
|
+
// rebuild while a browser may still be asking for it: between a `stat`
|
|
138
|
+
// and a stream the file could vanish, the stream then threw with nobody
|
|
139
|
+
// listening, and the server went down in the middle of a save. Read at
|
|
140
|
+
// once, a file is either there or answered 404 — and its length is the
|
|
141
|
+
// one actually sent, not the one a rebuild was busy changing.
|
|
142
|
+
let body;
|
|
138
143
|
try {
|
|
139
|
-
|
|
144
|
+
body = await readFile(filepath);
|
|
140
145
|
} catch {
|
|
141
146
|
response.writeHead(404, { 'content-type': 'text/plain; charset=utf-8' });
|
|
142
147
|
response.end(`404 — ${url.pathname}`);
|
|
@@ -147,18 +152,17 @@ export function createStaticServer({ root, basePath = '/', inject = null, onRelo
|
|
|
147
152
|
const headers = { 'content-type': type, 'cache-control': 'no-cache' };
|
|
148
153
|
|
|
149
154
|
if (inject && type.startsWith('text/html')) {
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
const body = html.includes('</body>')
|
|
155
|
+
const html = body.toString('utf8');
|
|
156
|
+
const page = html.includes('</body>')
|
|
153
157
|
? html.replace('</body>', `${inject}</body>`)
|
|
154
158
|
: html + inject;
|
|
155
|
-
response.writeHead(200, { ...headers, 'content-length': Buffer.byteLength(
|
|
156
|
-
response.end(
|
|
159
|
+
response.writeHead(200, { ...headers, 'content-length': Buffer.byteLength(page) });
|
|
160
|
+
response.end(page);
|
|
157
161
|
return;
|
|
158
162
|
}
|
|
159
163
|
|
|
160
|
-
response.writeHead(200, { ...headers, 'content-length':
|
|
161
|
-
|
|
164
|
+
response.writeHead(200, { ...headers, 'content-length': body.length });
|
|
165
|
+
response.end(body);
|
|
162
166
|
});
|
|
163
167
|
}
|
|
164
168
|
|
|
@@ -122,8 +122,10 @@ follows the reader's system; `'dark'` or `'light'` keeps one whatever the
|
|
|
122
122
|
system — the build sets it as a class on `<html>`.
|
|
123
123
|
|
|
124
124
|
The header also carries a button that switches between light and dark, and
|
|
125
|
-
remembers the reader's choice from page to page — a few hundred bytes of
|
|
126
|
-
script, the only
|
|
125
|
+
remembers the reader's choice from page to page — a few hundred bytes of
|
|
126
|
+
script written into the page, the only script that is not a file of the site.
|
|
127
|
+
A Content-Security-Policy allows it by its hash, which the
|
|
128
|
+
[deployment guide](./deployment/) gives. `theme.toggle: false` removes it.
|
|
127
129
|
Without JavaScript, the button does not show.
|
|
128
130
|
|
|
129
131
|
The dark palette is a set of tokens, the same under both themes. To change it,
|
|
@@ -160,9 +160,47 @@ For pages that are news rather than reference — release notes, a changelog —
|
|
|
160
160
|
give them a `date` and set `feed: true`: `feed.xml` then lists them, newest
|
|
161
161
|
first. The fields are in the [configuration reference](../reference/configuration/).
|
|
162
162
|
|
|
163
|
+
For programs that read documentation on someone's behalf, `llms: true` writes
|
|
164
|
+
`llms.txt` at the root and a Markdown copy beside each page — the text
|
|
165
|
+
without the markup. It needs no `siteUrl`.
|
|
166
|
+
|
|
163
167
|
## What the reader downloads
|
|
164
168
|
|
|
165
169
|
The build keeps it light on its own. The stylesheet is minified — a third to
|
|
166
170
|
half lighter. Every image of a page gets its width and height, read from its
|
|
167
171
|
file, so that the text does not jump when it arrives, and all but the first
|
|
168
172
|
load lazily, when the reader nears them. There is nothing to configure.
|
|
173
|
+
|
|
174
|
+
## A Content-Security-Policy
|
|
175
|
+
|
|
176
|
+
A Content-Security-Policy tells the browser what a page may load and run, so
|
|
177
|
+
that a script slipped into it is refused. A host that lets you set response
|
|
178
|
+
headers can send one with the site, and the pages hold up under a strict one —
|
|
179
|
+
one line in the header, split here to be read:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
default-src 'self';
|
|
183
|
+
script-src 'self' 'sha256-9V5TjnZ1QZI4gqywFKZk0OWiHyt6/BX2XWMibvI5UKc=' 'sha256-uoMvfl2Wu3fqzsh38hLYURHzlNXf65BbRUVEBM5sots=';
|
|
184
|
+
style-src 'self'; style-src-attr 'unsafe-inline';
|
|
185
|
+
object-src 'none'; base-uri 'self'; frame-ancestors 'none'
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- **The two hashes** are the two scripts written into the page by the light /
|
|
189
|
+
dark button: one applies the reader's choice before the first paint, the
|
|
190
|
+
other runs the button. Their words come from the button itself, in the
|
|
191
|
+
language of the page, so the scripts are the same text on every page of
|
|
192
|
+
every site: the hashes do not change with your content. They change with the
|
|
193
|
+
tool — after an update, a refused script names in the browser console the
|
|
194
|
+
hash it expected. `theme.toggle: false` removes both scripts, and the hashes
|
|
195
|
+
with them.
|
|
196
|
+
- **Every other script is a file of the site** — the client file of the
|
|
197
|
+
version, the search script and its index — which `'self'` covers.
|
|
198
|
+
- **`style-src-attr 'unsafe-inline'`** is the one allowance. The code
|
|
199
|
+
highlighter colours each word with a `style` attribute, and some components
|
|
200
|
+
size themselves that way. It lets style attributes through, not `<style>`
|
|
201
|
+
elements, and a style attribute runs no code.
|
|
202
|
+
|
|
203
|
+
This policy was checked in a browser against the pages of this site: search,
|
|
204
|
+
copy buttons, calendars and the light / dark button all work, and nothing is
|
|
205
|
+
refused. If your pages load anything from another address — an image, a font —
|
|
206
|
+
add that address to the matching directive.
|
|
@@ -40,6 +40,18 @@ npx docpensieve check
|
|
|
40
40
|
every other block.
|
|
41
41
|
- **An error keeps its hint.** An error the tool raises while a page compiles
|
|
42
42
|
no longer comes out as a generic syntax complaint.
|
|
43
|
+
- **A setting that did nothing now stops the build.** `copyCode: 'yes'` turned
|
|
44
|
+
the button off in silence, and a `TimeTimer` with a `start` but no
|
|
45
|
+
`duration` hid its content; both now name what is wrong. Build once after
|
|
46
|
+
updating: that is where it shows.
|
|
47
|
+
- **`ScrollToTop`, `Menu` and the light / dark button speak the language of
|
|
48
|
+
the page** when you give them no label of your own. A project that writes
|
|
49
|
+
its own words in `ui` gets two more to write: `switchToLight` and
|
|
50
|
+
`switchToDark`.
|
|
51
|
+
- **A reader stays in their language from one version to another.** The
|
|
52
|
+
version switcher, the notice of a beta and the links of the header led a
|
|
53
|
+
French reader to the English pages; they now lead to the French ones
|
|
54
|
+
wherever they exist.
|
|
43
55
|
|
|
44
56
|
## What is worth turning on
|
|
45
57
|
|
|
@@ -48,6 +60,7 @@ npx docpensieve check
|
|
|
48
60
|
- `copyCode`, a copy button on every code block — off by default, since it is
|
|
49
61
|
what makes a page load a script. See [the reference](../reference/configuration/).
|
|
50
62
|
- `snippetIcons`, if your project installs an icon collection.
|
|
63
|
+
- `llms`, for `llms.txt` and a Markdown copy of each page.
|
|
51
64
|
|
|
52
65
|
## What to check afterwards
|
|
53
66
|
|
|
@@ -69,6 +69,23 @@ Nothing already published moves, which is the point: a link shared last year
|
|
|
69
69
|
still leads where it led. The translation lives **inside** the version, so a
|
|
70
70
|
version is still one folder, one orphan branch, one stylesheet.
|
|
71
71
|
|
|
72
|
+
## Moving from one version to another
|
|
73
|
+
|
|
74
|
+
The version switcher, the notice on a beta or an archive, and the links of the
|
|
75
|
+
header lead to another version — in the reader's language when that version
|
|
76
|
+
has the page in it, in the language of the site when it does not. A French
|
|
77
|
+
reader of the beta who follows its notice lands on the French pages of the
|
|
78
|
+
current version; a version never translated opens in the language it was
|
|
79
|
+
written in, rather than on an address that leads nowhere.
|
|
80
|
+
|
|
81
|
+
The links you write in a page stay in their language by themselves, as long as
|
|
82
|
+
they are written from the page. A link that starts from the root of the
|
|
83
|
+
version — `/guide/install/` — leads to the French page from a French page. A
|
|
84
|
+
relative link climbs from the folder of its file, and the folders of a
|
|
85
|
+
translation mirror those of the site language: write it as the twin page
|
|
86
|
+
writes it. One level too many and it leaves the language, which `check` cannot
|
|
87
|
+
see — the English page it lands on exists.
|
|
88
|
+
|
|
72
89
|
## A page nobody translated
|
|
73
90
|
|
|
74
91
|
It does not exist in that language. It is absent from the menu of that
|
|
@@ -344,3 +344,25 @@ in none: a class of yours always wins, even to undo the default style.
|
|
|
344
344
|
|
|
345
345
|
The commonest row is a row of cards; [Columns](./columns/) shows how to keep
|
|
346
346
|
them the same height, which a grid alone does not.
|
|
347
|
+
|
|
348
|
+
## Properties
|
|
349
|
+
|
|
350
|
+
`Card`:
|
|
351
|
+
|
|
352
|
+
| Property | Type | Effect |
|
|
353
|
+
| ----------- | --------- | ---------------------------------------------------------------- |
|
|
354
|
+
| `elevated` | `boolean` | Adds a shadow. |
|
|
355
|
+
| `href` | `string` | Makes the whole card a link, resolved like any link of the page. |
|
|
356
|
+
| `className` | `string` | Classes added to the card. |
|
|
357
|
+
| `style` | `object` | Inline styles on the card. |
|
|
358
|
+
|
|
359
|
+
`CardImage`:
|
|
360
|
+
|
|
361
|
+
| Property | Type | Effect |
|
|
362
|
+
| -------------------------- | -------- | ---------------------------------------------------------------- |
|
|
363
|
+
| `src` | `string` | The image, resolved like any link of the page. |
|
|
364
|
+
| `alt` | `string` | What the image shows. Empty by default: the image is decorative. |
|
|
365
|
+
| `loading` | `string` | `lazy`, the default, or `eager`. |
|
|
366
|
+
| `title`, `srcSet`, `sizes` | `string` | Passed to the image as they are. |
|
|
367
|
+
|
|
368
|
+
`CardHeader`, `CardBody` and `CardFooter` take `className` and `style`.
|
|
@@ -287,3 +287,15 @@ window to check.
|
|
|
287
287
|
|
|
288
288
|
The most frequent row is a row of cards; [Card](./card/) shows how to keep
|
|
289
289
|
them to the same height, which a grid alone does not do.
|
|
290
|
+
|
|
291
|
+
## Properties
|
|
292
|
+
|
|
293
|
+
`Column`:
|
|
294
|
+
|
|
295
|
+
| Property | Type | Effect |
|
|
296
|
+
| ----------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
297
|
+
| `span` | `number` | Tracks taken out of twelve — `6` for a half, `8` for two thirds. Without it, the columns share the space equally. |
|
|
298
|
+
| `className` | `string` | Classes added to the column. |
|
|
299
|
+
| `style` | `object` | Inline styles on the column. |
|
|
300
|
+
|
|
301
|
+
`Columns` takes `className` and `style`. A `Column` outside a `Columns` stops the build.
|
|
@@ -119,6 +119,30 @@ integration, whose time zone is not yours.
|
|
|
119
119
|
A misspelt duration stops the build, and so does an invalid date. The message
|
|
120
120
|
names the faulty value and recalls the expected format.
|
|
121
121
|
|
|
122
|
+
So does a timer that names no period: no `date` at all, a `start` without its
|
|
123
|
+
`duration`, a `duration` beside a `date`, or a `date` and a `start` together.
|
|
124
|
+
Each of these used to show nothing, without a word — a block gone from the
|
|
125
|
+
page, and nothing to say why.
|
|
126
|
+
|
|
122
127
|
Announcing a release is what this is usually for, and [Versions](../guide/versions/)
|
|
123
128
|
covers the rest of that cycle — the banner a prerelease carries on its own,
|
|
124
129
|
and the day the two tracks swap.
|
|
130
|
+
|
|
131
|
+
## Properties
|
|
132
|
+
|
|
133
|
+
`TimeTimer`:
|
|
134
|
+
|
|
135
|
+
| Property | Type | Effect |
|
|
136
|
+
| ---------- | --------- | ------------------------------------------------------------------------------------- |
|
|
137
|
+
| `date` | `string` | A single day, `DD/MM/YYYY`, optionally followed by `HH:mm`. The year may be left out. |
|
|
138
|
+
| `start` | `string` | Start of a period, in the same format, with `duration`. |
|
|
139
|
+
| `duration` | `string` | Length of the period from `start`: `30d`, `2h`, `45m`. |
|
|
140
|
+
| `strict` | `boolean` | Reads the dates in UTC rather than in local time. |
|
|
141
|
+
| `now` | `Date` | For tests only: without it, the moment of the build stands. |
|
|
142
|
+
|
|
143
|
+
The fallbacks each take one bound:
|
|
144
|
+
|
|
145
|
+
| Property | Type | Effect |
|
|
146
|
+
| --------------------------- | -------- | ----------------------------------------------------------------------- |
|
|
147
|
+
| `start` on `FallbackBefore` | `string` | From when the content before the period shows. Without it, from always. |
|
|
148
|
+
| `end` on `FallbackAfter` | `string` | Until when the content after the period shows. Without it, for good. |
|
|
@@ -138,3 +138,12 @@ unnoticed for a long time. So does an unknown side.
|
|
|
138
138
|
|
|
139
139
|
A tooltip explains a term without leaving the sentence. A remark that needs
|
|
140
140
|
its own space is an [Admonition](./admonition/) instead.
|
|
141
|
+
|
|
142
|
+
## Properties
|
|
143
|
+
|
|
144
|
+
| Property | Type | Effect |
|
|
145
|
+
| ----------- | -------- | ------------------------------------------------------------------ |
|
|
146
|
+
| `text` | `string` | Content of the bubble. Required: an empty bubble would never show. |
|
|
147
|
+
| `placement` | `string` | `top`, the default, `bottom`, `left` or `right`. |
|
|
148
|
+
| `className` | `string` | Classes added to the term. |
|
|
149
|
+
| `style` | `object` | Inline styles on the term. |
|
|
@@ -195,3 +195,16 @@ label is refused too.
|
|
|
195
195
|
A tree is how this documentation shows the shape of a project. What those
|
|
196
196
|
folders become once built — the order, the addresses — is in
|
|
197
197
|
[Writing pages](../guide/writing-pages/).
|
|
198
|
+
|
|
199
|
+
## Properties
|
|
200
|
+
|
|
201
|
+
`TreeItem`:
|
|
202
|
+
|
|
203
|
+
| Property | Type | Effect |
|
|
204
|
+
| ----------- | --------------- | ------------------------------------------- |
|
|
205
|
+
| `label` | text or element | What the line shows. |
|
|
206
|
+
| `open` | `boolean` | Opens the branch as soon as the page opens. |
|
|
207
|
+
| `className` | `string` | Classes added to the line. |
|
|
208
|
+
| `style` | `object` | Inline styles on the line. |
|
|
209
|
+
|
|
210
|
+
`Tree` takes `className` and `style`.
|
|
@@ -144,3 +144,13 @@ build is enough to keep it right.
|
|
|
144
144
|
|
|
145
145
|
Setting one up takes a few lines in the pipeline that already builds the
|
|
146
146
|
site: [Deployment](../guide/deployment/) has the recipe.
|
|
147
|
+
|
|
148
|
+
## Properties
|
|
149
|
+
|
|
150
|
+
| Property | Type | Effect |
|
|
151
|
+
| ----------- | -------- | ------------------------------------------------------------------------------------------------------------- |
|
|
152
|
+
| `label` | `string` | Name read by a screen reader. By default, the words of the page's language — "Back to top", "Retour en haut". |
|
|
153
|
+
| `className` | `string` | Classes added to the button. |
|
|
154
|
+
| `style` | `object` | Inline styles on the button. |
|
|
155
|
+
|
|
156
|
+
Its children, when it has any, replace the arrow.
|
|
@@ -274,3 +274,19 @@ is full from the start — the value stays readable, which is what matters.
|
|
|
274
274
|
A level outside 0–100 stops the build, as does a gauge without a name, a level
|
|
275
275
|
that is not a number, or an unknown `shape`. A silent or overflowing bar goes
|
|
276
276
|
unnoticed on review.
|
|
277
|
+
|
|
278
|
+
## Properties
|
|
279
|
+
|
|
280
|
+
| Property | Type | Effect |
|
|
281
|
+
| ----------- | --------------- | ------------------------------------------------------------------------------ |
|
|
282
|
+
| `name` | text or element | What is measured. |
|
|
283
|
+
| `level` | `number` | The level, as a percentage. |
|
|
284
|
+
| `showValue` | `boolean` | Shows the percentage. On by default; off, the gauge still announces its value. |
|
|
285
|
+
| `shape` | `string` | `bar`, the default, or `circle`. |
|
|
286
|
+
| `icon` | element | Shown before the name — a `LogoIcon` fits there. |
|
|
287
|
+
| `color` | `string` | Colour of the fill: any CSS colour, the accent by default. |
|
|
288
|
+
| `label` | `string` | Name for screen readers, when `name` is not text. |
|
|
289
|
+
| `className` | `string` | Classes added to the gauge. |
|
|
290
|
+
| `style` | `object` | Inline styles on the gauge. |
|
|
291
|
+
|
|
292
|
+
Its children stand as a comment under the gauge.
|
|
@@ -171,3 +171,13 @@ A component loads no JavaScript, and this one is not going to introduce any.
|
|
|
171
171
|
|
|
172
172
|
A kind of admonition takes its mark through this same component — see
|
|
173
173
|
[Admonition](./admonition/).
|
|
174
|
+
|
|
175
|
+
## Properties
|
|
176
|
+
|
|
177
|
+
| Property | Type | Effect |
|
|
178
|
+
| ----------- | -------- | --------------------------------------------------------------------------------------- |
|
|
179
|
+
| `src` | `string` | An SVG of the project, or `prefix:name` from an installed icon collection. |
|
|
180
|
+
| `label` | `string` | What the icon means. Without it, the icon is decorative and hidden from screen readers. |
|
|
181
|
+
| `size` | `string` | Any CSS length. |
|
|
182
|
+
| `className` | `string` | Classes added to the icon. |
|
|
183
|
+
| `style` | `object` | Inline styles on the icon. |
|
|
@@ -46,3 +46,9 @@ without a word.
|
|
|
46
46
|
|
|
47
47
|
Which theme a project runs is one field of its configuration, and the whole
|
|
48
48
|
of what it changes is in [Themes](../guide/themes/).
|
|
49
|
+
|
|
50
|
+
## Properties
|
|
51
|
+
|
|
52
|
+
| Property | Type | Effect |
|
|
53
|
+
| ----------- | -------- | ---------------------------------------------------------------- |
|
|
54
|
+
| `framework` | `string` | `tailwind` or `custom`: the content shows only under that theme. |
|
|
@@ -74,3 +74,12 @@ themes, so this needs no variant:
|
|
|
74
74
|
Like every component here, the grid is built at the build. What reaches the
|
|
75
75
|
reader is a list of links: it works with JavaScript turned off, and a card
|
|
76
76
|
never waits for anything to become clickable.
|
|
77
|
+
|
|
78
|
+
## Properties
|
|
79
|
+
|
|
80
|
+
| Property | Type | Effect |
|
|
81
|
+
| ----------- | -------- | ----------------------------------------------------------------------------------------------------- |
|
|
82
|
+
| `of` | `string` | `all`, the default; `series` for the sub-folders alone; `pages` for the pages beside the index alone. |
|
|
83
|
+
| `from` | `string` | Slug of another folder to list, instead of the one holding the page. |
|
|
84
|
+
| `className` | `string` | Classes added to the grid. |
|
|
85
|
+
| `style` | `object` | Inline styles on the grid. |
|
|
@@ -127,3 +127,25 @@ A `MenuLink` or a `MenuGroup` written outside a `Menu` stops the build, and so
|
|
|
127
127
|
does an entry without a target or a group without a title. Each of these would
|
|
128
128
|
otherwise render something that looks like a menu and leads nowhere — the kind
|
|
129
129
|
of fault a review does not catch.
|
|
130
|
+
|
|
131
|
+
## Properties
|
|
132
|
+
|
|
133
|
+
`Menu`:
|
|
134
|
+
|
|
135
|
+
| Property | Type | Effect |
|
|
136
|
+
| -------- | -------- | ----------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| `label` | `string` | Name for screen readers, and label of the button it folds into. By default, the page's own word for a menu. |
|
|
138
|
+
|
|
139
|
+
`MenuLink`:
|
|
140
|
+
|
|
141
|
+
| Property | Type | Effect |
|
|
142
|
+
| -------- | -------- | ------------------------------------------------- |
|
|
143
|
+
| `href` | `string` | Where it leads, resolved like any link. Required. |
|
|
144
|
+
|
|
145
|
+
`MenuGroup`:
|
|
146
|
+
|
|
147
|
+
| Property | Type | Effect |
|
|
148
|
+
| -------- | -------- | ------------------------------- |
|
|
149
|
+
| `title` | `string` | Heading of the group. Required. |
|
|
150
|
+
|
|
151
|
+
All three take `className` and `style`.
|
|
@@ -152,3 +152,12 @@ Its orphan branch keeps what was built, and the history keeps the sources.
|
|
|
152
152
|
Like every component here, it is rendered at the build. It is an `aside`
|
|
153
153
|
announced as a note, with its icon hidden from screen readers — the title
|
|
154
154
|
beside it already says the kind, and saying it twice helps nobody.
|
|
155
|
+
|
|
156
|
+
## Properties
|
|
157
|
+
|
|
158
|
+
| Property | Type | Effect |
|
|
159
|
+
| ----------- | -------- | ---------------------------------------------------------------------------------------------------------- |
|
|
160
|
+
| `type` | `string` | The kind: `note`, the default, `info`, `tip`, `attention`, `alert`, `danger`, or one the project declares. |
|
|
161
|
+
| `title` | `string` | Replaces the label of the kind, for this block alone. |
|
|
162
|
+
| `className` | `string` | Classes added to the block. |
|
|
163
|
+
| `style` | `object` | Inline styles on the block. |
|
|
@@ -76,6 +76,7 @@ can change.
|
|
|
76
76
|
| `sitemap` | `true` | `sitemap.xml` of the published versions, once `siteUrl` is set |
|
|
77
77
|
| `feed` | `false` | RSS feed of the dated pages. Needs `siteUrl` |
|
|
78
78
|
| `search` | `true` | Search field in the header, and a search page built with the site |
|
|
79
|
+
| `llms` | `false` | `llms.txt` at the root of the site, and a Markdown copy of each page |
|
|
79
80
|
|
|
80
81
|
## Images
|
|
81
82
|
|
|
@@ -137,6 +138,38 @@ The search page is kept out of search engines (`noindex`) and out of the
|
|
|
137
138
|
sitemap. A page of your own at `/search/` would take its place: the build
|
|
138
139
|
refuses it, and `search: false` frees the address.
|
|
139
140
|
|
|
141
|
+
## `llms`
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
llms: true,
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
A program that reads documentation on someone's behalf — an assistant
|
|
148
|
+
answering a question, a tool gathering the pages of a project — does better
|
|
149
|
+
with the text than with the markup around it. `llms: true` gives it two ways
|
|
150
|
+
in:
|
|
151
|
+
|
|
152
|
+
- **`llms.txt`**, at the root of the site: the project name, the description
|
|
153
|
+
of the home page, then one link per page of the current version, with its
|
|
154
|
+
description. Each language of the version has its own section. The file
|
|
155
|
+
follows the llms.txt proposal, at the address programs look for it.
|
|
156
|
+
- **A Markdown copy of each page**, beside its HTML: `/guide/install/` has its
|
|
157
|
+
copy at `/guide/install/index.html.md`, and every page names its copy in its
|
|
158
|
+
head, with `<link rel="alternate" type="text/markdown">`. The copy is the
|
|
159
|
+
source of the page as you wrote it, headed by its title and description.
|
|
160
|
+
|
|
161
|
+
What a component draws at build time is not in the copy — a grid of cards,
|
|
162
|
+
the file a snippet reads: it says what was written, not what was rendered.
|
|
163
|
+
|
|
164
|
+
It needs no `siteUrl`: the links start from the root of the domain until the
|
|
165
|
+
site has an address, and are absolute once it has one. Like the sitemap,
|
|
166
|
+
`llms.txt` is written by the build of the whole site; `build <version>` alone
|
|
167
|
+
writes the copies of that version only.
|
|
168
|
+
|
|
169
|
+
It is off by default. It doubles the files of a version, and whether programs
|
|
170
|
+
should read your pages is yours to decide. It is a proposal, not a standard:
|
|
171
|
+
reading it is up to each program.
|
|
172
|
+
|
|
140
173
|
## `copyCode`
|
|
141
174
|
|
|
142
175
|
`copyCode: true` puts a button on every block of code, which copies it.
|
|
@@ -571,6 +571,12 @@ humanised from their slug by `StructuredDataBuilder`.
|
|
|
571
571
|
|
|
572
572
|
**Returns** `FoldedNode[]`
|
|
573
573
|
|
|
574
|
+
### `MARKDOWN_COPY`
|
|
575
|
+
|
|
576
|
+
`MARKDOWN_COPY`
|
|
577
|
+
|
|
578
|
+
File a page's Markdown copy is written to, beside its HTML.
|
|
579
|
+
|
|
574
580
|
### `buildFeed`
|
|
575
581
|
|
|
576
582
|
`buildFeed(pages, site)`
|
|
@@ -588,6 +594,25 @@ every page again at every build.
|
|
|
588
594
|
|
|
589
595
|
**Returns** `string`
|
|
590
596
|
|
|
597
|
+
### `buildLlms`
|
|
598
|
+
|
|
599
|
+
`buildLlms(pages, site)`
|
|
600
|
+
|
|
601
|
+
Builds `llms.txt`: the index of a documentation, for a reader that is a
|
|
602
|
+
program.
|
|
603
|
+
|
|
604
|
+
Follows the proposal as it stands: a title, a one-line summary, then a list
|
|
605
|
+
of links, each to the Markdown copy of a page — the address of the page with
|
|
606
|
+
`index.html.md` appended, since the pages are folders. A program reads that
|
|
607
|
+
copy as the author wrote it, instead of prying the text out of the markup.
|
|
608
|
+
|
|
609
|
+
| Parameter | Type | |
|
|
610
|
+
| --- | --- | --- |
|
|
611
|
+
| `pages` | `PublishedPage[]` | Pages of the version the site serves first. |
|
|
612
|
+
| `site` | `{ projectName: string, summary?: string, base?: string }` | `base` makes each link absolute when the site has a public address, and root-relative otherwise. |
|
|
613
|
+
|
|
614
|
+
**Returns** `string`
|
|
615
|
+
|
|
591
616
|
### `buildRobots`
|
|
592
617
|
|
|
593
618
|
`buildRobots(sitemapUrl)`
|
|
@@ -616,6 +641,30 @@ that carries neither is listed without one rather than with a made-up date.
|
|
|
616
641
|
|
|
617
642
|
**Returns** `string`
|
|
618
643
|
|
|
644
|
+
### `markdownCopy`
|
|
645
|
+
|
|
646
|
+
`markdownCopy(frontmatter, content, [resolve])`
|
|
647
|
+
|
|
648
|
+
The Markdown copy of a page: its source, as the author wrote it.
|
|
649
|
+
|
|
650
|
+
The title is added when the page does not open on one, since a program
|
|
651
|
+
handed the copy alone has no frontmatter to read it from. What a component
|
|
652
|
+
draws at build time is not in the copy — a snippet's file, a grid of cards:
|
|
653
|
+
the copy says what was written, not what was rendered.
|
|
654
|
+
|
|
655
|
+
The links are the exception. The build resolves them from the folder of the
|
|
656
|
+
source file, and a version-root one from the version: read from where the
|
|
657
|
+
copy is served, as written, they would lead nowhere. `resolve` gives each the
|
|
658
|
+
address the HTML page carries.
|
|
659
|
+
|
|
660
|
+
| Parameter | Type | |
|
|
661
|
+
| --- | --- | --- |
|
|
662
|
+
| `frontmatter` | `{ title?: string, description?: string }` | |
|
|
663
|
+
| `content` | `string` | Source of the page, frontmatter removed. |
|
|
664
|
+
| `[resolve]` | `(target: string) => string \| null` | Address of a target on the site, or `null` to keep it as written. |
|
|
665
|
+
|
|
666
|
+
**Returns** `string`
|
|
667
|
+
|
|
619
668
|
### `buildAuthorTable`
|
|
620
669
|
|
|
621
670
|
`buildAuthorTable(description, options)`
|
package/starter/05-whats-new.md
CHANGED
|
@@ -85,6 +85,26 @@ until the `ui` field gives it its own.
|
|
|
85
85
|
|
|
86
86
|
[Languages](./guide/languages/) · [The init options](./reference/cli/)
|
|
87
87
|
|
|
88
|
+
### Pages a program can read
|
|
89
|
+
|
|
90
|
+
`llms: true` writes `llms.txt` at the root of the site — the project, then a
|
|
91
|
+
link to every page of the current version — and a Markdown copy beside each
|
|
92
|
+
page, `index.html.md`, that its head names. An assistant asked about your
|
|
93
|
+
project reads the text you wrote rather than prying it out of the HTML. Off by
|
|
94
|
+
default, and it needs no `siteUrl`.
|
|
95
|
+
|
|
96
|
+
[The field](./reference/configuration/)
|
|
97
|
+
|
|
98
|
+
### A strict Content-Security-Policy
|
|
99
|
+
|
|
100
|
+
The light / dark button no longer writes its words into its script: they come
|
|
101
|
+
from the page, in its language — a French page used to name the button in
|
|
102
|
+
English to a screen reader. Its two scripts are then the same text on every
|
|
103
|
+
page, and a Content-Security-Policy allows them by their hash. The deployment
|
|
104
|
+
guide gives a strict policy, checked in a browser against this site.
|
|
105
|
+
|
|
106
|
+
[The policy](./guide/deployment/)
|
|
107
|
+
|
|
88
108
|
## For a 0.4 project
|
|
89
109
|
|
|
90
110
|
Nothing to change: a 0.4 configuration builds as it is, and a site already in
|