docpensieve 0.3.0-beta.1 → 0.3.0-beta.2
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 +5 -0
- package/starter/01-guide/03-writing-pages.md +40 -0
- package/starter/01-guide/07-migrate-to-beta.md +15 -2
- package/starter/01-guide/index.md +1 -14
- package/starter/02-components/10-cards.mdx +76 -0
- package/starter/02-components/index.mdx +1 -9
- package/starter/03-reference/02-configuration.md +16 -0
- package/starter/03-reference/03-frontmatter.md +12 -12
- package/starter/03-reference/05-api.md +81 -0
- package/starter/03-reference/index.md +1 -7
- package/starter/05-whats-new.md +16 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docpensieve",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.2",
|
|
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.3.0-beta.
|
|
28
|
-
"@docpensieve/core": "0.3.0-beta.
|
|
29
|
-
"@docpensieve/shared": "0.3.0-beta.
|
|
30
|
-
"@docpensieve/theme": "0.3.0-beta.
|
|
27
|
+
"@docpensieve/components": "0.3.0-beta.2",
|
|
28
|
+
"@docpensieve/core": "0.3.0-beta.2",
|
|
29
|
+
"@docpensieve/shared": "0.3.0-beta.2",
|
|
30
|
+
"@docpensieve/theme": "0.3.0-beta.2",
|
|
31
31
|
"chalk": "^6.0.0",
|
|
32
32
|
"chokidar": "^5.0.0",
|
|
33
33
|
"commander": "^15.0.0"
|
package/src/commands/init.js
CHANGED
|
@@ -266,6 +266,11 @@ function renderConfig({ name, theme, siteUrl, version }) {
|
|
|
266
266
|
' // version folder.',
|
|
267
267
|
" sidebar: 'auto',",
|
|
268
268
|
'',
|
|
269
|
+
' // Authors described in a JSON file of each version folder: a name, a',
|
|
270
|
+
' // biography, an avatar, a link. Left empty, a page still shows the',
|
|
271
|
+
' // names its frontmatter gives, without the rest.',
|
|
272
|
+
" authors: '',",
|
|
273
|
+
'',
|
|
269
274
|
' // The shipped components — Card, Columns, Tooltip… — usable in any .mdx',
|
|
270
275
|
' // page without an import. false removes them, to use your own names.',
|
|
271
276
|
' globalComponents: true,',
|
|
@@ -31,6 +31,46 @@ without `title`, the project name stands in.
|
|
|
31
31
|
|
|
32
32
|
The fields are detailed in the [reference](../reference/frontmatter/).
|
|
33
33
|
|
|
34
|
+
## Who wrote the page
|
|
35
|
+
|
|
36
|
+
A page that names its authors, or carries a date, opens with a byline:
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
---
|
|
40
|
+
title: Installation
|
|
41
|
+
authors: [ada, grace]
|
|
42
|
+
date: 2026-09-09
|
|
43
|
+
modified: 2026-09-16
|
|
44
|
+
---
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The names show as written. To give them a biography, an avatar and a link,
|
|
48
|
+
describe them in a JSON file of the version folder:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"ada": {
|
|
53
|
+
"name": "Ada Lovelace",
|
|
54
|
+
"bio": "Wrote the first algorithm meant for a machine.",
|
|
55
|
+
"avatar": "authors/ada.png",
|
|
56
|
+
"url": "https://example.com/ada"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then name that file in the configuration: `authors: 'authors.json'`. It is
|
|
62
|
+
read **in each version folder**, as the menu is — a biography corrected in
|
|
63
|
+
the version being written leaves the published one alone. The file itself is
|
|
64
|
+
not published; the avatars are, and are measured at the build so that the
|
|
65
|
+
text does not jump when they arrive.
|
|
66
|
+
|
|
67
|
+
A key nobody describes is shown as written, which is what lets a project name
|
|
68
|
+
its authors before describing them. The description also feeds the page data:
|
|
69
|
+
a biography becomes the `description` of its `Person`, a link its `url`.
|
|
70
|
+
|
|
71
|
+
A date written the day the page was is not repeated as an update, and a home
|
|
72
|
+
page carries no byline at all: it is an entrance hall, not a document.
|
|
73
|
+
|
|
34
74
|
## What the URL depends on
|
|
35
75
|
|
|
36
76
|
The file path gives the URL path, stripped of its extension and of its sorting
|
|
@@ -20,5 +20,18 @@ Through `npx` alone, `npx docpensieve@beta` runs the beta. Going back is
|
|
|
20
20
|
|
|
21
21
|
## What changes on its own
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
| What | In 0.3 |
|
|
24
|
+
| ------------------------------------------ | ----------------------------------------------- |
|
|
25
|
+
| Pages with `authors`, `date` or `modified` | Open with a byline naming the authors and dates |
|
|
26
|
+
|
|
27
|
+
Nothing to change, but something to know: those three fields already existed,
|
|
28
|
+
read by the sitemap and the page data without ever being shown. They are now
|
|
29
|
+
shown, so a page that carries them gains a block it did not have. A page that
|
|
30
|
+
carries none of them looks exactly as before.
|
|
31
|
+
|
|
32
|
+
## What to turn on
|
|
33
|
+
|
|
34
|
+
| Field | Gives |
|
|
35
|
+
| ---------------------------- | ----------------------------------------------------- |
|
|
36
|
+
| `authors: 'authors.json'` | Biographies, avatars and links, described per version |
|
|
37
|
+
| `<Cards />` in an index page | A grid of cards built from the pages of the folder |
|
|
@@ -13,20 +13,7 @@ jsonld:
|
|
|
13
13
|
These pages are read in order. Each one starts from what the previous one set
|
|
14
14
|
up.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
a project.
|
|
18
|
-
2. **[First site](./first-site/)** — build, serve, look at what was
|
|
19
|
-
produced.
|
|
20
|
-
3. **[Writing pages](./writing-pages/)** — frontmatter, URLs, menu, links,
|
|
21
|
-
images.
|
|
22
|
-
4. **[Versions](./versions/)** — several documentation versions, one
|
|
23
|
-
branch each.
|
|
24
|
-
5. **[Themes](./themes/)** — style the site, change the classes without
|
|
25
|
-
touching the HTML.
|
|
26
|
-
6. **[Deployment](./deployment/)** — publish, and keep past versions
|
|
27
|
-
online.
|
|
28
|
-
7. **[Migrate from latest to beta](./migrate-to-beta/)** — move a 0.2 project
|
|
29
|
-
to the 0.3 beta.
|
|
16
|
+
<Cards />
|
|
30
17
|
|
|
31
18
|
## What to know first
|
|
32
19
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Cards
|
|
3
|
+
description: Grids of clickable cards, built from the pages of the version.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cards
|
|
7
|
+
|
|
8
|
+
A folder is a **series**: its `index` page introduces it, and the pages beside
|
|
9
|
+
that index are its instalments. `Cards` turns that structure into a grid,
|
|
10
|
+
rather than a list written by hand — a hand-written index goes stale at the
|
|
11
|
+
first page renamed, and nothing says so.
|
|
12
|
+
|
|
13
|
+
## On this page
|
|
14
|
+
|
|
15
|
+
Placed in a page, the component lists what stands beside it. Here, the other
|
|
16
|
+
component pages:
|
|
17
|
+
|
|
18
|
+
<Cards />
|
|
19
|
+
|
|
20
|
+
```mdx
|
|
21
|
+
<Cards />
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Written in the `index` page of a folder, it lists that folder instead: a series
|
|
25
|
+
page shows its own instalments, not its neighbours.
|
|
26
|
+
|
|
27
|
+
## What a card carries
|
|
28
|
+
|
|
29
|
+
Everything comes from the pages themselves, nothing is declared twice:
|
|
30
|
+
|
|
31
|
+
| Shown | Read from |
|
|
32
|
+
| --------------- | -------------------------------------------------------------- |
|
|
33
|
+
| Title | `title` of the page |
|
|
34
|
+
| Description | `description` of the page |
|
|
35
|
+
| Image | `preview` of the page, resolved from the page that declares it |
|
|
36
|
+
| Number of pages | Counted under the folder — on a series card only |
|
|
37
|
+
| Update date | `modified`, or failing that `date` |
|
|
38
|
+
|
|
39
|
+
The **whole card is the link**, never the title alone: a card whose surface
|
|
40
|
+
does nothing invites a click that is lost.
|
|
41
|
+
|
|
42
|
+
## Narrowing the grid
|
|
43
|
+
|
|
44
|
+
| Prop | Effect |
|
|
45
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
46
|
+
| `of` | `series` keeps the folders, `pages` keeps the pages beside the index |
|
|
47
|
+
| `from` | Reads another folder, named by its path within the version |
|
|
48
|
+
| `className` | Classes added to the grid |
|
|
49
|
+
| `style` | Inline styling, for a one-off adjustment |
|
|
50
|
+
|
|
51
|
+
```mdx
|
|
52
|
+
<Cards of="series" />
|
|
53
|
+
<Cards from="guide" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`from` names a folder of **this** version, as it appears in a URL: `guide`, or
|
|
57
|
+
`guide/advanced`. It stops the build when nothing lives under that path, which
|
|
58
|
+
catches a typo rather than rendering an empty grid.
|
|
59
|
+
|
|
60
|
+
## Sizing
|
|
61
|
+
|
|
62
|
+
The grid fills the width it is given, with as many columns as fit. To hold it
|
|
63
|
+
narrower, set a width on the block — tokens and lengths work under both
|
|
64
|
+
themes, so this needs no variant:
|
|
65
|
+
|
|
66
|
+
```mdx
|
|
67
|
+
<div style={{ maxWidth: '32rem' }}>
|
|
68
|
+
<Cards of="series" />
|
|
69
|
+
</div>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Without JavaScript
|
|
73
|
+
|
|
74
|
+
Like every component here, the grid is built at the build. What reaches the
|
|
75
|
+
reader is a list of links: it works with JavaScript turned off, and a card
|
|
76
|
+
never waits for anything to become clickable.
|
|
@@ -63,15 +63,7 @@ changes the examples too.
|
|
|
63
63
|
|
|
64
64
|
## Available
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
- [Columns](./columns/) — column grid
|
|
68
|
-
- [TimeTimer](./time-timer/) — display depending on a date
|
|
69
|
-
- [Tooltip](./tooltip/) — tooltip on hover and from the keyboard
|
|
70
|
-
- [Tree](./tree/) — collapsible tree
|
|
71
|
-
- [ScrollToTop](./scroll-to-top/) — back to the top of the page
|
|
72
|
-
- [Skill](./skill/) — level gauge
|
|
73
|
-
- [LogoIcon](./logo-icon/) — SVG icon inlined in the page
|
|
74
|
-
- [ForTheme](./for-theme/) — content kept for one theme only
|
|
66
|
+
<Cards />
|
|
75
67
|
|
|
76
68
|
## Without JavaScript
|
|
77
69
|
|
|
@@ -177,6 +177,22 @@ Longer rules go in the `theme/` folder, at the root of the project: every
|
|
|
177
177
|
`docpensieve dev` picks up every change. Under the `custom` theme, `init`
|
|
178
178
|
starts it with `theme/custom.css`.
|
|
179
179
|
|
|
180
|
+
## `authors`
|
|
181
|
+
|
|
182
|
+
```js
|
|
183
|
+
authors: 'authors.json',
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Names a JSON file **read in each version folder**, describing the authors a
|
|
187
|
+
page names in its frontmatter: a name, a biography, an avatar, a link.
|
|
188
|
+
|
|
189
|
+
Empty by default, and then a page still shows the names it gives, without the
|
|
190
|
+
rest: the file enriches, it does not command. Named but missing, it stops the
|
|
191
|
+
build — leaving every biography out without a word would be worse.
|
|
192
|
+
|
|
193
|
+
The file is not published. The avatars are, their path starting at the version
|
|
194
|
+
folder so that they travel with it.
|
|
195
|
+
|
|
180
196
|
## `sidebar`
|
|
181
197
|
|
|
182
198
|
`'auto'` builds the menu from the file tree: folders become categories, and the
|
|
@@ -38,18 +38,18 @@ jsonld:
|
|
|
38
38
|
|
|
39
39
|
## The fields
|
|
40
40
|
|
|
41
|
-
| Field | Effect
|
|
42
|
-
| ------------- |
|
|
43
|
-
| `title` | `<title>` tag, menu entry, breadcrumb, JSON-LD `headline`
|
|
44
|
-
| `description` | `description` metadata and JSON-LD `description`
|
|
45
|
-
| `date` | Publication date
|
|
46
|
-
| `modified` | Last modification date. Default: the publication date
|
|
47
|
-
| `authors` |
|
|
48
|
-
| `tags` | Keywords, carried over as `keywords`
|
|
49
|
-
| `preview` | Image of the page. The path is resolved like a link
|
|
50
|
-
| `draft` | `true` keeps the page out of the output
|
|
51
|
-
| `layout` | `doc` (default) or `home`
|
|
52
|
-
| `jsonld` | Structured data settings
|
|
41
|
+
| Field | Effect |
|
|
42
|
+
| ------------- | -------------------------------------------------------------------------- |
|
|
43
|
+
| `title` | `<title>` tag, menu entry, breadcrumb, JSON-LD `headline` |
|
|
44
|
+
| `description` | `description` metadata and JSON-LD `description` |
|
|
45
|
+
| `date` | Publication date |
|
|
46
|
+
| `modified` | Last modification date. Default: the publication date. Shown in the byline |
|
|
47
|
+
| `authors` | Authors of the page, by name or by key of the version's author file |
|
|
48
|
+
| `tags` | Keywords, carried over as `keywords` |
|
|
49
|
+
| `preview` | Image of the page. The path is resolved like a link |
|
|
50
|
+
| `draft` | `true` keeps the page out of the output |
|
|
51
|
+
| `layout` | `doc` (default) or `home` |
|
|
52
|
+
| `jsonld` | Structured data settings |
|
|
53
53
|
|
|
54
54
|
## `layout`
|
|
55
55
|
|
|
@@ -488,6 +488,75 @@ that carries neither is listed without one rather than with a made-up date.
|
|
|
488
488
|
|
|
489
489
|
**Returns** `string`
|
|
490
490
|
|
|
491
|
+
### `buildAuthorTable`
|
|
492
|
+
|
|
493
|
+
`buildAuthorTable(description, options)`
|
|
494
|
+
|
|
495
|
+
Turns the JSON description of a version into a table of authors.
|
|
496
|
+
|
|
497
|
+
| Parameter | Type | |
|
|
498
|
+
| --- | --- | --- |
|
|
499
|
+
| `description` | `unknown` | Parsed content of the file. |
|
|
500
|
+
| `options` | `{ source: string }` | `source` names the file in errors. |
|
|
501
|
+
|
|
502
|
+
**Returns** `Map<string, Author>`
|
|
503
|
+
|
|
504
|
+
**Throws** `ConfigError` — When the shape is wrong, naming the offending entry.
|
|
505
|
+
|
|
506
|
+
### `buildByline`
|
|
507
|
+
|
|
508
|
+
`buildByline(frontmatter, [table], [where])`
|
|
509
|
+
|
|
510
|
+
Assembles what the head of a page shows, or nothing when it has none of it.
|
|
511
|
+
|
|
512
|
+
| Parameter | Type | |
|
|
513
|
+
| --- | --- | --- |
|
|
514
|
+
| `frontmatter` | `Record<string, any>` | |
|
|
515
|
+
| `[table]` | `Map<string, Author>` | |
|
|
516
|
+
| `[where]` | `string` | Page named in a date error. |
|
|
517
|
+
|
|
518
|
+
**Returns** `Byline \| null`
|
|
519
|
+
|
|
520
|
+
**Throws** `ConfigError` — When a date cannot be read.
|
|
521
|
+
|
|
522
|
+
### `readDate`
|
|
523
|
+
|
|
524
|
+
`readDate(value, field, where)`
|
|
525
|
+
|
|
526
|
+
Reads a date of the frontmatter, and gives it in both forms: the machine one
|
|
527
|
+
for `<time datetime>`, the readable one for the reader.
|
|
528
|
+
|
|
529
|
+
A date is often written unquoted in YAML, which parses it as a Date; quoted,
|
|
530
|
+
it arrives as text. Both are accepted, anything unreadable is refused rather
|
|
531
|
+
than shown as `Invalid Date`.
|
|
532
|
+
|
|
533
|
+
| Parameter | Type | |
|
|
534
|
+
| --- | --- | --- |
|
|
535
|
+
| `value` | `unknown` | |
|
|
536
|
+
| `field` | `string` | Name of the field, for the error message. |
|
|
537
|
+
| `where` | `string` | Page the date comes from. |
|
|
538
|
+
|
|
539
|
+
**Returns** `{ iso: string, label: string } \| null` — `null` when absent.
|
|
540
|
+
|
|
541
|
+
**Throws** `ConfigError` — When the value is not a date.
|
|
542
|
+
|
|
543
|
+
### `resolvePageAuthors`
|
|
544
|
+
|
|
545
|
+
`resolvePageAuthors(value, [table])`
|
|
546
|
+
|
|
547
|
+
The authors of a page, in the order the frontmatter names them.
|
|
548
|
+
|
|
549
|
+
A key the table does not describe is not an error: the name is shown as
|
|
550
|
+
written. It is what lets a project name its authors before describing them,
|
|
551
|
+
and what keeps pages written before the file working.
|
|
552
|
+
|
|
553
|
+
| Parameter | Type | |
|
|
554
|
+
| --- | --- | --- |
|
|
555
|
+
| `value` | `unknown` | `authors` from the frontmatter: one name or a list. |
|
|
556
|
+
| `[table]` | `Map<string, Author>` | |
|
|
557
|
+
|
|
558
|
+
**Returns** `Author[]`
|
|
559
|
+
|
|
491
560
|
## `@docpensieve/theme`
|
|
492
561
|
|
|
493
562
|
The theme providers and the engine that composes them.
|
|
@@ -642,6 +711,18 @@ itself (ADR-006).
|
|
|
642
711
|
| --- | --- | --- |
|
|
643
712
|
| `props` | `{ className?: string, style?: object, src?: string, alt?: string, title?: string, srcSet?: string, sizes?: string, loading?: 'lazy' \| 'eager', }` | `alt` defaults to the empty string: without that attribute, a screen reader would announce the file URL. |
|
|
644
713
|
|
|
714
|
+
### `Cards`
|
|
715
|
+
|
|
716
|
+
`Cards(props)`
|
|
717
|
+
|
|
718
|
+
Grid of cards for the children of a folder.
|
|
719
|
+
|
|
720
|
+
| Parameter | Type | |
|
|
721
|
+
| --- | --- | --- |
|
|
722
|
+
| `props` | `{ className?: string, style?: object, of?: 'all' \| 'series' \| 'pages', from?: string, }` | `of` narrows the grid to the sub-folders (`'series'`) or to the pages beside the index (`'pages'`); `from` reads another folder, named by its slug, instead of the one holding the page. |
|
|
723
|
+
|
|
724
|
+
**Throws** `Error` — When the page list is missing, or `from` names nothing.
|
|
725
|
+
|
|
645
726
|
### `Column`
|
|
646
727
|
|
|
647
728
|
`Column(props)`
|
|
@@ -10,13 +10,7 @@ jsonld:
|
|
|
10
10
|
|
|
11
11
|
# Reference
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
and their options.
|
|
15
|
-
- **[Configuration](./configuration/)** — every field of
|
|
16
|
-
`docpensieve.config.mjs`, its default value and its effect.
|
|
17
|
-
- **[Frontmatter](./frontmatter/)** — the fields recognised at the top
|
|
18
|
-
of a page.
|
|
19
|
-
- **[Theme](./theme/)** — slots, tokens and styling options.
|
|
13
|
+
<Cards />
|
|
20
14
|
|
|
21
15
|
To learn how to use them rather than look them up, the [guide](../guide/) is the
|
|
22
16
|
right starting point.
|
package/starter/05-whats-new.md
CHANGED
|
@@ -16,10 +16,22 @@ npx docpensieve@beta init my-site
|
|
|
16
16
|
|
|
17
17
|
## Already there
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
written
|
|
19
|
+
### Authors at the head of a page
|
|
20
|
+
|
|
21
|
+
A page carrying `authors`, `date` or `modified` now opens with a byline: who
|
|
22
|
+
wrote it, and when. The names show as written; a JSON file of the version,
|
|
23
|
+
named by `authors: 'authors.json'`, adds a biography, an avatar and a link —
|
|
24
|
+
and feeds the page data with them. See
|
|
25
|
+
[Who wrote the page](./guide/writing-pages/) in the guide, and the
|
|
26
|
+
[`authors` field](./reference/configuration/) in the reference.
|
|
27
|
+
|
|
28
|
+
### Series and cards
|
|
29
|
+
|
|
30
|
+
A folder is a series: its `index` page introduces it, and the pages beside
|
|
31
|
+
that index are its instalments. The `Cards` component turns that structure
|
|
32
|
+
into a grid of clickable cards — title, description, image, number of pages,
|
|
33
|
+
update date — instead of an index list written by hand, which goes stale at
|
|
34
|
+
the first page renamed. See [Cards](./components/cards/).
|
|
23
35
|
|
|
24
36
|
## For a 0.2 project
|
|
25
37
|
|