docpensieve 0.3.0-beta.1 → 0.3.0
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 +21 -3
- package/starter/01-guide/01-installation.md +3 -3
- package/starter/01-guide/03-writing-pages.md +65 -4
- package/starter/01-guide/07-migrate-from-0-2.md +47 -0
- package/starter/01-guide/{index.md → index.mdx} +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 +46 -2
- package/starter/03-reference/03-frontmatter.md +12 -12
- package/starter/03-reference/04-theme.md +13 -0
- package/starter/03-reference/05-api.md +81 -0
- package/starter/03-reference/{index.md → index.mdx} +1 -7
- package/starter/05-whats-new.md +43 -10
- package/starter/01-guide/07-migrate-to-beta.md +0 -24
- /package/starter/01-guide/{05-themes.md → 05-themes.mdx} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docpensieve",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
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
|
|
28
|
-
"@docpensieve/core": "0.3.0
|
|
29
|
-
"@docpensieve/shared": "0.3.0
|
|
30
|
-
"@docpensieve/theme": "0.3.0
|
|
27
|
+
"@docpensieve/components": "0.3.0",
|
|
28
|
+
"@docpensieve/core": "0.3.0",
|
|
29
|
+
"@docpensieve/shared": "0.3.0",
|
|
30
|
+
"@docpensieve/theme": "0.3.0",
|
|
31
31
|
"chalk": "^6.0.0",
|
|
32
32
|
"chokidar": "^5.0.0",
|
|
33
33
|
"commander": "^15.0.0"
|
package/src/commands/init.js
CHANGED
|
@@ -47,10 +47,19 @@ const EXAMPLES_CSS = 'examples.css';
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Entries of DocPensieve's documentation that are not installed with the
|
|
50
|
-
* pages: its home page and the icons only that page uses
|
|
51
|
-
* DocPensieve's own site, and the
|
|
50
|
+
* pages: its home page and the icons only that page uses, the example site
|
|
51
|
+
* and the author descriptions belong to DocPensieve's own site, and the
|
|
52
|
+
* examples' stylesheet has a place of its own. Installed, the author file
|
|
53
|
+
* would even be published as a plain file on every user's site.
|
|
52
54
|
*/
|
|
53
|
-
const NOT_INSTALLED = new Set([
|
|
55
|
+
const NOT_INSTALLED = new Set([
|
|
56
|
+
'index.md',
|
|
57
|
+
'index.mdx',
|
|
58
|
+
'icons',
|
|
59
|
+
'06-examples',
|
|
60
|
+
'authors.json',
|
|
61
|
+
EXAMPLES_CSS,
|
|
62
|
+
]);
|
|
54
63
|
|
|
55
64
|
/** Starting point of the project's own stylesheet, under the custom theme. */
|
|
56
65
|
const CUSTOM_CSS = fileURLToPath(new URL('../templates/custom.css', import.meta.url));
|
|
@@ -266,6 +275,15 @@ function renderConfig({ name, theme, siteUrl, version }) {
|
|
|
266
275
|
' // version folder.',
|
|
267
276
|
" sidebar: 'auto',",
|
|
268
277
|
'',
|
|
278
|
+
' // Authors described in a JSON file of each version folder: a name, a',
|
|
279
|
+
' // biography, an avatar, a link. Left empty, a page still shows the',
|
|
280
|
+
' // names its frontmatter gives, without the rest.',
|
|
281
|
+
" authors: '',",
|
|
282
|
+
'',
|
|
283
|
+
' // Links of the header, beside the version switcher — behind a menu button',
|
|
284
|
+
" // on a narrow screen. For instance [{ label: 'Blog', href: '/blog/' }].",
|
|
285
|
+
' headerLinks: [],',
|
|
286
|
+
'',
|
|
269
287
|
' // The shipped components — Card, Columns, Tooltip… — usable in any .mdx',
|
|
270
288
|
' // page without an import. false removes them, to use your own names.',
|
|
271
289
|
' globalComponents: true,',
|
|
@@ -99,9 +99,9 @@ The documentation `init` installed in `99-docpensieve` stays at the version it
|
|
|
99
99
|
came with. To refresh it, run `init` in a scratch folder and copy that folder
|
|
100
100
|
over.
|
|
101
101
|
|
|
102
|
-
Coming from the 0.2, [Migrate from
|
|
103
|
-
|
|
104
|
-
`docpensieve@beta`, or run `npx docpensieve@beta` alone.
|
|
102
|
+
Coming from the 0.2, [Migrate from 0.2 to 0.3](./migrate-from-0-2/) says what
|
|
103
|
+
changes on its own and what to check first. To try the version being prepared,
|
|
104
|
+
install `docpensieve@beta`, or run `npx docpensieve@beta` alone.
|
|
105
105
|
|
|
106
106
|
## Checking
|
|
107
107
|
|
|
@@ -26,11 +26,53 @@ tags: [guide, installation]
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
`title` becomes the `<title>` tag, the menu entry and the breadcrumb.
|
|
29
|
-
`description` feeds the metadata and the JSON-LD.
|
|
30
|
-
|
|
29
|
+
`description` feeds the metadata and the JSON-LD. `tags` show at the bottom of
|
|
30
|
+
the page, below the text they describe — one tag may be written without
|
|
31
|
+
brackets. Everything is optional: without `title`, the project name stands in.
|
|
31
32
|
|
|
32
33
|
The fields are detailed in the [reference](../reference/frontmatter/).
|
|
33
34
|
|
|
35
|
+
## Who wrote the page
|
|
36
|
+
|
|
37
|
+
A page that names its authors, or carries a date, opens with a byline:
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
---
|
|
41
|
+
title: Installation
|
|
42
|
+
authors: [ada, grace]
|
|
43
|
+
date: 2026-09-09
|
|
44
|
+
modified: 2026-09-16
|
|
45
|
+
---
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The names show as written. To give them a biography, an avatar and a link,
|
|
49
|
+
describe them in a JSON file of the version folder:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"ada": {
|
|
54
|
+
"name": "Ada Lovelace",
|
|
55
|
+
"bio": "Wrote the first algorithm meant for a machine.",
|
|
56
|
+
"avatar": "authors/ada.png",
|
|
57
|
+
"url": "https://example.com/ada"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then name that file in the configuration: `authors: 'authors.json'`. It is
|
|
63
|
+
read **in each version folder**, as the menu is — a biography corrected in
|
|
64
|
+
the version being written leaves the published one alone. The file itself is
|
|
65
|
+
not published; the avatars are, and are measured at the build so that the
|
|
66
|
+
text does not jump when they arrive. A version without the file shows the
|
|
67
|
+
names alone: an older version needs no copy of it.
|
|
68
|
+
|
|
69
|
+
A key nobody describes is shown as written, which is what lets a project name
|
|
70
|
+
its authors before describing them. The description also feeds the page data:
|
|
71
|
+
a biography becomes the `description` of its `Person`, a link its `url`.
|
|
72
|
+
|
|
73
|
+
A date written the day the page was is not repeated as an update, and a home
|
|
74
|
+
page carries no byline at all: it is an entrance hall, not a document.
|
|
75
|
+
|
|
34
76
|
## What the URL depends on
|
|
35
77
|
|
|
36
78
|
The file path gives the URL path, stripped of its extension and of its sorting
|
|
@@ -65,6 +107,23 @@ docs/v1.0/
|
|
|
65
107
|
└── 01-card.mdx
|
|
66
108
|
```
|
|
67
109
|
|
|
110
|
+
## Series of pages
|
|
111
|
+
|
|
112
|
+
A folder is a **series**: its `index` page introduces it, and the pages beside
|
|
113
|
+
that index are its instalments. Written in that index, one line builds the grid
|
|
114
|
+
of its pages, as clickable cards:
|
|
115
|
+
|
|
116
|
+
```mdx
|
|
117
|
+
<Cards />
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Each card takes the `title` and `description` of its page, its `preview` as an
|
|
121
|
+
image, and its `modified` date. On the index of a folder that holds other
|
|
122
|
+
folders, the cards of those series also count their pages. Nothing is listed
|
|
123
|
+
by hand, so nothing goes stale when a page is added or renamed.
|
|
124
|
+
|
|
125
|
+
The [Cards](../components/cards/) page details every option.
|
|
126
|
+
|
|
68
127
|
## Writing the menu by hand
|
|
69
128
|
|
|
70
129
|
When the file tree does not give the menu you want, describe it in a JSON file
|
|
@@ -86,8 +145,10 @@ sidebar: 'sidebar.json',
|
|
|
86
145
|
|
|
87
146
|
A page is named by its path, as in its URL. `{ "auto": "components" }` keeps
|
|
88
147
|
the automatic menu of a folder — the DocPensieve section stays whole that way.
|
|
89
|
-
A page the file leaves out is still published, only off the menu
|
|
90
|
-
|
|
148
|
+
A page the file leaves out is still published, only off the menu, and a
|
|
149
|
+
version without the file keeps the menu of its folders — an older version
|
|
150
|
+
needs no copy of it. Every kind of entry is in the
|
|
151
|
+
[`sidebar` reference](../reference/configuration/).
|
|
91
152
|
|
|
92
153
|
## Internal links
|
|
93
154
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrate from 0.2 to 0.3
|
|
3
|
+
description: Move a project from the 0.2 to the 0.3 — what changes on its own, and what to turn on.
|
|
4
|
+
tags: [guide, migration]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Migrate from 0.2 to 0.3
|
|
8
|
+
|
|
9
|
+
A project on the 0.2 builds with the 0.3 as it is: every new field is optional.
|
|
10
|
+
|
|
11
|
+
## Update
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install docpensieve@latest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Through `npx` alone, `npx docpensieve` fetches the 0.3 by itself. Going back is
|
|
18
|
+
`npm install docpensieve@0.2.0`.
|
|
19
|
+
|
|
20
|
+
## What changes on its own
|
|
21
|
+
|
|
22
|
+
| What | In 0.3 |
|
|
23
|
+
| ------------------------------------------ | ----------------------------------------------- |
|
|
24
|
+
| Pages with `authors`, `date` or `modified` | Open with a byline naming the authors and dates |
|
|
25
|
+
|
|
26
|
+
Nothing to change, but something to know: those three fields already existed,
|
|
27
|
+
read by the sitemap and the page data without ever being shown. They are now
|
|
28
|
+
shown, so a page that carries them gains a block it did not have. A page that
|
|
29
|
+
carries none of them looks exactly as before.
|
|
30
|
+
|
|
31
|
+
`tags` follows the same path: read until now only by the page data, it now
|
|
32
|
+
shows at the bottom of every page that carries it.
|
|
33
|
+
|
|
34
|
+
One constraint is gone, too. A `sidebar` or `authors` file named in the
|
|
35
|
+
configuration no longer has to exist in every version folder: a version
|
|
36
|
+
without it keeps the menu of its folders, or shows the names alone.
|
|
37
|
+
|
|
38
|
+
On a narrow screen, the header changes for every site: the version switcher and
|
|
39
|
+
the search field move behind a menu button. Nothing to configure — `headerLinks`
|
|
40
|
+
only adds links to that menu.
|
|
41
|
+
|
|
42
|
+
## What to turn on
|
|
43
|
+
|
|
44
|
+
| Field | Gives |
|
|
45
|
+
| ---------------------------- | ----------------------------------------------------- |
|
|
46
|
+
| `authors: 'authors.json'` | Biographies, avatars and links, described per version |
|
|
47
|
+
| `<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
|
|
|
@@ -58,6 +58,8 @@ can change.
|
|
|
58
58
|
| `versions` | `[]` | At least one entry |
|
|
59
59
|
| `theme` | see below | Styling |
|
|
60
60
|
| `sidebar` | `'auto'` | `'auto'`: the menu follows the file tree. Or a `.json` file of each version folder |
|
|
61
|
+
| `authors` | `''` | A `.json` file describing the authors, in each version folder that has one |
|
|
62
|
+
| `headerLinks` | `[]` | Links of the header, beside the version switcher |
|
|
61
63
|
| `globalComponents` | `true` | Shipped components available without an import |
|
|
62
64
|
| `scrollToTop` | `true` | Back-to-top button on every page |
|
|
63
65
|
| `jsonld` | `{ enabled: true }` | Structured data |
|
|
@@ -177,6 +179,47 @@ Longer rules go in the `theme/` folder, at the root of the project: every
|
|
|
177
179
|
`docpensieve dev` picks up every change. Under the `custom` theme, `init`
|
|
178
180
|
starts it with `theme/custom.css`.
|
|
179
181
|
|
|
182
|
+
## `authors`
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
authors: 'authors.json',
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Names a JSON file **read in each version folder**, describing the authors a
|
|
189
|
+
page names in its frontmatter: a name, a biography, an avatar, a link.
|
|
190
|
+
|
|
191
|
+
Empty by default, and then a page still shows the names it gives, without the
|
|
192
|
+
rest: the file enriches, it does not command. A version without the file shows
|
|
193
|
+
the names alone, so describing the authors of a new version does not force a
|
|
194
|
+
copy into the older ones. A file present but unreadable, or wrongly written,
|
|
195
|
+
stops the build.
|
|
196
|
+
|
|
197
|
+
The file is not published. The avatars are, their path starting at the version
|
|
198
|
+
folder so that they travel with it.
|
|
199
|
+
|
|
200
|
+
## `headerLinks`
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
headerLinks: [
|
|
204
|
+
{ label: 'Blog', href: '/blog/' },
|
|
205
|
+
{ label: 'Examples', href: '/examples/', version: 'beta' },
|
|
206
|
+
{ label: 'Repository', href: 'https://github.com/me/my-project' },
|
|
207
|
+
],
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Links of the header, beside the version switcher. A target starts from the root
|
|
211
|
+
of the version — `/blog/` — or is a full address. A relative target is refused:
|
|
212
|
+
the header is on every page, and `blog/` would mean something else on each.
|
|
213
|
+
|
|
214
|
+
`version` names the version a link leads to. Without it, each version links to
|
|
215
|
+
its own page; with it, every version leads to that one — which is how a section
|
|
216
|
+
written in one version only stays reachable from all of them. A version nobody
|
|
217
|
+
declared stops the build.
|
|
218
|
+
|
|
219
|
+
On a narrow screen, the version switcher, the links and the search field move
|
|
220
|
+
behind a menu button. It is a native element that opens without a script, like
|
|
221
|
+
the version switcher itself.
|
|
222
|
+
|
|
180
223
|
## `sidebar`
|
|
181
224
|
|
|
182
225
|
`'auto'` builds the menu from the file tree: folders become categories, and the
|
|
@@ -187,8 +230,9 @@ sidebar: 'sidebar.json',
|
|
|
187
230
|
```
|
|
188
231
|
|
|
189
232
|
It is read from **each version's folder** — `docs/v1.0/sidebar.json` — since
|
|
190
|
-
each version has its own pages.
|
|
191
|
-
written
|
|
233
|
+
each version has its own pages. A version without the file keeps the menu of
|
|
234
|
+
its folders, so a menu written for a new version needs no copy in the older
|
|
235
|
+
ones. The file holds an array of entries, kept in the order written:
|
|
192
236
|
|
|
193
237
|
```json
|
|
194
238
|
[
|
|
@@ -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` |
|
|
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` | Shown at the bottom of the page, and carried over as JSON-LD `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
|
|
|
@@ -101,6 +101,19 @@ the `dp-*` class below.
|
|
|
101
101
|
| `scrollTopIcon` | `dp-scroll-top-icon` | Arrow of that button |
|
|
102
102
|
| `search` | `dp-search` | Search field of the header |
|
|
103
103
|
| `schemeToggle` | `dp-scheme-toggle` | Light / dark button of the header |
|
|
104
|
+
| `headerNav` | `dp-header-nav` | Versions, links and search, in a row |
|
|
105
|
+
| `headerLinks` | `dp-header-links` | Links of the header |
|
|
106
|
+
| `menu` | `dp-menu` | Menu button, on a narrow screen |
|
|
107
|
+
| `menuPanel` | `dp-menu-panel` | What that button opens |
|
|
108
|
+
| `byline` | `dp-byline` | Authors and dates at the head of a page |
|
|
109
|
+
| `bylineAuthors` | `dp-byline-authors` | List of the authors |
|
|
110
|
+
| `bylineAuthor` | `dp-byline-author` | One author |
|
|
111
|
+
| `bylineAvatar` | `dp-byline-avatar` | Avatar of an author |
|
|
112
|
+
| `bylineName` | `dp-byline-name` | Name of an author |
|
|
113
|
+
| `bylineBio` | `dp-byline-bio` | Biography of an author |
|
|
114
|
+
| `bylineDates` | `dp-byline-dates` | Writing and update dates |
|
|
115
|
+
| `tags` | `dp-tags` | Tags at the bottom of a page |
|
|
116
|
+
| `tag` | `dp-tag` | One tag |
|
|
104
117
|
|
|
105
118
|
A slot can carry **variants**, suffixed `--variant`: `column` gives
|
|
106
119
|
`dp-column--span-8`, `skill` gives `dp-skill--circle`.
|
|
@@ -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
|
@@ -6,23 +6,56 @@ tags: [release]
|
|
|
6
6
|
|
|
7
7
|
# What's new in 0.3
|
|
8
8
|
|
|
9
|
-
This version is **
|
|
10
|
-
|
|
11
|
-
`latest` pages of this site:
|
|
9
|
+
This version is **out**. It is what `npx docpensieve init my-site` installs,
|
|
10
|
+
and what the `latest` pages of this site document:
|
|
12
11
|
|
|
13
12
|
```bash
|
|
14
|
-
|
|
13
|
+
npm install docpensieve@latest
|
|
15
14
|
```
|
|
16
15
|
|
|
17
|
-
##
|
|
16
|
+
## What it brings
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
written
|
|
18
|
+
### Authors at the head of a page
|
|
19
|
+
|
|
20
|
+
A page carrying `authors`, `date` or `modified` now opens with a byline: who
|
|
21
|
+
wrote it, and when. The names show as written; a JSON file of the version,
|
|
22
|
+
named by `authors: 'authors.json'`, adds a biography, an avatar and a link —
|
|
23
|
+
and feeds the page data with them. See
|
|
24
|
+
[Who wrote the page](./guide/writing-pages/) in the guide, and the
|
|
25
|
+
[`authors` field](./reference/configuration/) in the reference.
|
|
26
|
+
|
|
27
|
+
### Series and cards
|
|
28
|
+
|
|
29
|
+
A folder is a series: its `index` page introduces it, and the pages beside
|
|
30
|
+
that index are its instalments. The `Cards` component turns that structure
|
|
31
|
+
into a grid of clickable cards — title, description, image, number of pages,
|
|
32
|
+
update date — instead of an index list written by hand, which goes stale at
|
|
33
|
+
the first page renamed. See [Cards](./components/cards/).
|
|
34
|
+
|
|
35
|
+
### Tags at the bottom of a page
|
|
36
|
+
|
|
37
|
+
The `tags` of a page, read until now only by its structured data, show at the
|
|
38
|
+
bottom of the page, below the text they describe. See
|
|
39
|
+
[The frontmatter](./guide/writing-pages/) in the guide.
|
|
40
|
+
|
|
41
|
+
### Description files, optional per version
|
|
42
|
+
|
|
43
|
+
A `sidebar` or `authors` file named in the configuration no longer has to
|
|
44
|
+
exist in every version folder. A version without it keeps the menu of its
|
|
45
|
+
folders, or shows the names its pages give: describing the menu or the authors
|
|
46
|
+
of a new version no longer forces a copy into the older ones. A file present
|
|
47
|
+
but unreadable, or wrongly written, still stops the build.
|
|
48
|
+
|
|
49
|
+
### Header links, and a menu on narrow screens
|
|
50
|
+
|
|
51
|
+
`headerLinks` adds links to the header, beside the version switcher — each may
|
|
52
|
+
name the version it leads to, so that a section written in one version is
|
|
53
|
+
reachable from all of them. On a narrow screen, the switcher, the links and the
|
|
54
|
+
search field move behind a menu button, which opens without a script. See the
|
|
55
|
+
[`headerLinks` field](./reference/configuration/).
|
|
23
56
|
|
|
24
57
|
## For a 0.2 project
|
|
25
58
|
|
|
26
59
|
Nothing to change: a 0.2 configuration builds as it is.
|
|
27
|
-
[Migrate from
|
|
60
|
+
[Migrate from 0.2 to 0.3](./guide/migrate-from-0-2/) lists what changes on
|
|
28
61
|
its own, what to check, and what is worth turning on.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Migrate from latest to beta
|
|
3
|
-
description: Move a project from the latest version, the 0.2, to the 0.3 beta — what changes on its own, and what to check.
|
|
4
|
-
tags: [guide, migration]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Migrate from latest to beta
|
|
8
|
-
|
|
9
|
-
A project on the latest version — the 0.2 — builds with the 0.3 beta as it is:
|
|
10
|
-
every new field is optional.
|
|
11
|
-
|
|
12
|
-
## Update
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install docpensieve@beta
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Through `npx` alone, `npx docpensieve@beta` runs the beta. Going back is
|
|
19
|
-
`npm install docpensieve@latest`.
|
|
20
|
-
|
|
21
|
-
## What changes on its own
|
|
22
|
-
|
|
23
|
-
Nothing yet: the 0.3 has just opened. Each change is listed here as it lands,
|
|
24
|
-
beside what it asks of a project already built on the 0.2.
|
|
File without changes
|