docpensieve 0.3.0 → 0.4.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 +4 -0
- package/starter/01-guide/01-installation.md +3 -3
- package/starter/01-guide/07-migrate-to-beta.md +27 -0
- package/starter/01-guide/08-navigation.mdx +126 -0
- package/starter/03-reference/02-configuration.md +47 -0
- package/starter/03-reference/04-theme.md +7 -0
- package/starter/03-reference/05-api.md +11 -0
- package/starter/05-whats-new.md +23 -46
- package/starter/01-guide/07-migrate-from-0-2.md +0 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docpensieve",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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.
|
|
28
|
-
"@docpensieve/core": "0.
|
|
29
|
-
"@docpensieve/shared": "0.
|
|
30
|
-
"@docpensieve/theme": "0.
|
|
27
|
+
"@docpensieve/components": "0.4.0-beta.2",
|
|
28
|
+
"@docpensieve/core": "0.4.0-beta.2",
|
|
29
|
+
"@docpensieve/shared": "0.4.0-beta.2",
|
|
30
|
+
"@docpensieve/theme": "0.4.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
|
@@ -284,6 +284,10 @@ function renderConfig({ name, theme, siteUrl, version }) {
|
|
|
284
284
|
" // on a narrow screen. For instance [{ label: 'Blog', href: '/blog/' }].",
|
|
285
285
|
' headerLinks: [],',
|
|
286
286
|
'',
|
|
287
|
+
' // Categories of the menu fold, opened on the branch of the page being',
|
|
288
|
+
' // read. Useful once the documentation is long.',
|
|
289
|
+
' foldedSidebar: false,',
|
|
290
|
+
'',
|
|
287
291
|
' // The shipped components — Card, Columns, Tooltip… — usable in any .mdx',
|
|
288
292
|
' // page without an import. false removes them, to use your own names.',
|
|
289
293
|
' 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.
|
|
103
|
-
changes on its own and what to check first. To try
|
|
104
|
-
|
|
102
|
+
Coming from the 0.3, [Migrate from latest to beta](./migrate-to-beta/) says
|
|
103
|
+
what changes on its own and what to check first. To try this beta, install
|
|
104
|
+
`docpensieve@beta`, or run `npx docpensieve@beta` alone.
|
|
105
105
|
|
|
106
106
|
## Checking
|
|
107
107
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrate from latest to beta
|
|
3
|
+
description: Move a project from the latest version, the 0.3, to the 0.4 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.3 — builds with the 0.4 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.4 has just opened. Each change is listed here as it lands,
|
|
24
|
+
beside what it asks of a project already built on the 0.3.
|
|
25
|
+
|
|
26
|
+
One thing changes on its own: on a narrow screen, the menu of the documentation
|
|
27
|
+
now folds above the content instead of standing open. Nothing to configure.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Navigation
|
|
3
|
+
description: The menu of the documentation, the links of the header, and what becomes of both on a phone.
|
|
4
|
+
tags: [guide, navigation]
|
|
5
|
+
|
|
6
|
+
jsonld:
|
|
7
|
+
type: TechArticle
|
|
8
|
+
breadcrumbs: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Navigation
|
|
12
|
+
|
|
13
|
+
A reader finds a page in one of two ways: the menu of the documentation, on the
|
|
14
|
+
left, or the header, at the top. They answer different questions — _where am I
|
|
15
|
+
in this documentation_ and _where else can I go_ — and a site may use one, the
|
|
16
|
+
other, or both.
|
|
17
|
+
|
|
18
|
+
Neither loads a script. Everything here folds and unfolds with native elements.
|
|
19
|
+
|
|
20
|
+
## The menu of the documentation
|
|
21
|
+
|
|
22
|
+
It follows the file tree, or the file you describe — that is
|
|
23
|
+
[Writing the menu by hand](./writing-pages/). What changes here is how much of
|
|
24
|
+
it shows at once.
|
|
25
|
+
|
|
26
|
+
### Folding the categories
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
// docpensieve.config.mjs
|
|
30
|
+
foldedSidebar: true,
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Every category becomes a fold. **The branch holding the page being read is
|
|
34
|
+
open, the others closed**, so a menu of a hundred entries stops asking the
|
|
35
|
+
reader to scroll past what does not concern them.
|
|
36
|
+
|
|
37
|
+
<Columns>
|
|
38
|
+
<Column span={6}>
|
|
39
|
+
<Card style={{ height: '100%' }}>
|
|
40
|
+
<CardHeader>Unfolded — the default</CardHeader>
|
|
41
|
+
<CardBody>
|
|
42
|
+
Everything is visible at once. Right for a documentation of a few dozen pages, where
|
|
43
|
+
scrolling the menu costs nothing.
|
|
44
|
+
</CardBody>
|
|
45
|
+
</Card>
|
|
46
|
+
</Column>
|
|
47
|
+
<Column span={6}>
|
|
48
|
+
<Card style={{ height: '100%', borderColor: 'var(--dp-accent)' }}>
|
|
49
|
+
<CardHeader>Folded</CardHeader>
|
|
50
|
+
<CardBody>
|
|
51
|
+
Only the branch being read is open. Right once the menu is long enough that its end is out
|
|
52
|
+
of sight.
|
|
53
|
+
</CardBody>
|
|
54
|
+
</Card>
|
|
55
|
+
</Column>
|
|
56
|
+
</Columns>
|
|
57
|
+
|
|
58
|
+
A category that is also a page gains that page as its first entry. The handle
|
|
59
|
+
of a fold cannot be a link as well — a click would mean two things, and the
|
|
60
|
+
page would become unreachable.
|
|
61
|
+
|
|
62
|
+
## The header
|
|
63
|
+
|
|
64
|
+
`headerLinks` puts links beside the version switcher.
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
headerLinks: [{ label: 'Blog', href: '/blog/' }],
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
A target starts from the root of a version — `/blog/` — or is a full address. A
|
|
71
|
+
relative target is refused: the header is on every page, and `blog/` would mean
|
|
72
|
+
something else on each.
|
|
73
|
+
|
|
74
|
+
### A section that lives in one version
|
|
75
|
+
|
|
76
|
+
A link may name the version it leads to:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
{ label: 'Examples', href: '/examples/', version: 'latest' },
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Every version then leads there, which is what keeps a section written in one
|
|
83
|
+
version reachable from all of them. This site does exactly that for its
|
|
84
|
+
examples.
|
|
85
|
+
|
|
86
|
+
### A panel of links
|
|
87
|
+
|
|
88
|
+
An entry carrying `columns` opens a panel instead of leading anywhere:
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
{
|
|
92
|
+
label: 'Product',
|
|
93
|
+
columns: [
|
|
94
|
+
{
|
|
95
|
+
title: 'Guide',
|
|
96
|
+
items: [
|
|
97
|
+
{ label: 'Installation', href: '/guide/installation/' },
|
|
98
|
+
{ label: 'First site', href: '/guide/first-site/' },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{ items: [{ label: 'Repository', href: 'https://github.com/me/my-project' }] },
|
|
102
|
+
],
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
A column may go without a title. An entry cannot carry both `href` and
|
|
107
|
+
`columns`: it either leads somewhere or opens a panel.
|
|
108
|
+
|
|
109
|
+
The panel is declared here, **not derived from the menu of the documentation**.
|
|
110
|
+
The two are therefore free to show different things — or a site without a
|
|
111
|
+
sidebar can navigate from the header alone.
|
|
112
|
+
|
|
113
|
+
## On a phone
|
|
114
|
+
|
|
115
|
+
Nothing is left to overflow off the screen.
|
|
116
|
+
|
|
117
|
+
| What | Below 48rem | Below 56rem |
|
|
118
|
+
| -------------------------------------- | ------------------------------------ | ----------------------------------------------- |
|
|
119
|
+
| Version switcher, links, panel, search | Behind the menu button of the header | — |
|
|
120
|
+
| Menu of the documentation | — | Folded above the content, behind its own button |
|
|
121
|
+
|
|
122
|
+
The panel of links unfolds inside the header menu rather than over it, and the
|
|
123
|
+
documentation menu starts closed: open, it would fill the first screen before a
|
|
124
|
+
word is read.
|
|
125
|
+
|
|
126
|
+
Both buttons are native elements. With JavaScript turned off, they still open.
|
|
@@ -60,6 +60,7 @@ can change.
|
|
|
60
60
|
| `sidebar` | `'auto'` | `'auto'`: the menu follows the file tree. Or a `.json` file of each version folder |
|
|
61
61
|
| `authors` | `''` | A `.json` file describing the authors, in each version folder that has one |
|
|
62
62
|
| `headerLinks` | `[]` | Links of the header, beside the version switcher |
|
|
63
|
+
| `foldedSidebar` | `false` | Categories of the menu fold, opened where the reader stands |
|
|
63
64
|
| `globalComponents` | `true` | Shipped components available without an import |
|
|
64
65
|
| `scrollToTop` | `true` | Back-to-top button on every page |
|
|
65
66
|
| `jsonld` | `{ enabled: true }` | Structured data |
|
|
@@ -220,6 +221,52 @@ On a narrow screen, the version switcher, the links and the search field move
|
|
|
220
221
|
behind a menu button. It is a native element that opens without a script, like
|
|
221
222
|
the version switcher itself.
|
|
222
223
|
|
|
224
|
+
### A panel of links
|
|
225
|
+
|
|
226
|
+
An entry carrying `columns` opens a panel instead of leading anywhere:
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
headerLinks: [
|
|
230
|
+
{
|
|
231
|
+
label: 'Product',
|
|
232
|
+
columns: [
|
|
233
|
+
{
|
|
234
|
+
title: 'Guide',
|
|
235
|
+
items: [
|
|
236
|
+
{ label: 'Install', href: '/guide/installation/' },
|
|
237
|
+
{ label: 'Deploy', href: '/guide/deployment/' },
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
{ items: [{ label: 'Repository', href: 'https://github.com/me/my-project' }] },
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
A column may go without a title. Every link follows the rules above — absolute
|
|
247
|
+
target, optional `version`. An entry cannot carry both `href` and `columns`: it
|
|
248
|
+
either leads somewhere or opens a panel, never both.
|
|
249
|
+
|
|
250
|
+
The panel is declared here, not derived from the menu of the documentation: the
|
|
251
|
+
two can stand side by side with different links, or the site can go without a
|
|
252
|
+
sidebar and navigate from the header alone.
|
|
253
|
+
|
|
254
|
+
## `foldedSidebar`
|
|
255
|
+
|
|
256
|
+
```js
|
|
257
|
+
foldedSidebar: true,
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Every category of the menu becomes a fold. The branch holding the page being
|
|
261
|
+
read is open, the others closed: a menu of a hundred pages stops asking the
|
|
262
|
+
reader to scroll past what does not concern them. It folds without a script.
|
|
263
|
+
|
|
264
|
+
A category that is also a page gains that page as its first entry: the handle
|
|
265
|
+
of a fold cannot be a link as well without a click meaning two things.
|
|
266
|
+
|
|
267
|
+
Left to `false`, the menu shows whole, as before. On a narrow screen the whole
|
|
268
|
+
menu folds above the content either way, since the column has nowhere to stand.
|
|
269
|
+
|
|
223
270
|
## `sidebar`
|
|
224
271
|
|
|
225
272
|
`'auto'` builds the menu from the file tree: folders become categories, and the
|
|
@@ -105,6 +105,13 @@ the `dp-*` class below.
|
|
|
105
105
|
| `headerLinks` | `dp-header-links` | Links of the header |
|
|
106
106
|
| `menu` | `dp-menu` | Menu button, on a narrow screen |
|
|
107
107
|
| `menuPanel` | `dp-menu-panel` | What that button opens |
|
|
108
|
+
| `navGroup` | `dp-nav-group` | A folded category of the menu |
|
|
109
|
+
| `navSummary` | `dp-nav-summary` | The handle of that fold |
|
|
110
|
+
| `sidebarMenu` | `dp-sidebar-menu` | The documentation menu, on a narrow screen |
|
|
111
|
+
| `mega` | `dp-mega` | A header entry that opens a panel |
|
|
112
|
+
| `megaPanel` | `dp-mega-panel` | That panel |
|
|
113
|
+
| `megaColumn` | `dp-mega-column` | A column of the panel |
|
|
114
|
+
| `megaTitle` | `dp-mega-title` | The title of a column |
|
|
108
115
|
| `byline` | `dp-byline` | Authors and dates at the head of a page |
|
|
109
116
|
| `bylineAuthors` | `dp-byline-authors` | List of the authors |
|
|
110
117
|
| `bylineAuthor` | `dp-byline-author` | One author |
|
|
@@ -443,6 +443,17 @@ humanised from their slug by `StructuredDataBuilder`.
|
|
|
443
443
|
|
|
444
444
|
**Returns** `Record<string, string>` — Full folder slug to title.
|
|
445
445
|
|
|
446
|
+
### `foldSidebar`
|
|
447
|
+
|
|
448
|
+
`foldSidebar(nodes, [currentUrl])`
|
|
449
|
+
|
|
450
|
+
| Parameter | Type | |
|
|
451
|
+
| --- | --- | --- |
|
|
452
|
+
| `nodes` | `SidebarNode[]` | |
|
|
453
|
+
| `[currentUrl]` | `string` | URL of the page being rendered. |
|
|
454
|
+
|
|
455
|
+
**Returns** `FoldedNode[]`
|
|
456
|
+
|
|
446
457
|
### `buildFeed`
|
|
447
458
|
|
|
448
459
|
`buildFeed(pages, site)`
|
package/starter/05-whats-new.md
CHANGED
|
@@ -1,61 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: What's new in 0.
|
|
3
|
-
description: What the 0.
|
|
2
|
+
title: What's new in 0.4
|
|
3
|
+
description: What the 0.4 brings, and what it changes for a 0.3 project.
|
|
4
4
|
tags: [release]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# What's new in 0.
|
|
7
|
+
# What's new in 0.4
|
|
8
8
|
|
|
9
|
-
This version is **
|
|
10
|
-
|
|
9
|
+
This version is **in preparation**. Its betas go out under the npm tag `beta`,
|
|
10
|
+
while the version installed by default stays the 0.3, documented in the
|
|
11
|
+
`latest` pages of this site:
|
|
11
12
|
|
|
12
13
|
```bash
|
|
13
|
-
|
|
14
|
+
npx docpensieve@beta init my-site
|
|
14
15
|
```
|
|
15
16
|
|
|
16
|
-
##
|
|
17
|
+
## Already there
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
The 0.4 has just opened. What follows is what it already brings, and the rest of
|
|
20
|
+
its pages are still those of the 0.3. Each feature is announced here as it lands,
|
|
21
|
+
with a link to the guide and to the reference — this page announces, it is never
|
|
22
|
+
the only place something is written.
|
|
19
23
|
|
|
20
|
-
A
|
|
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.
|
|
24
|
+
### A menu that folds, and a panel of links in the header
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
`foldedSidebar: true` folds the categories of the menu, open on the branch the
|
|
27
|
+
reader stands in. On a narrow screen the whole menu folds above the content,
|
|
28
|
+
whatever that setting. And a `headerLinks` entry carrying `columns` opens a
|
|
29
|
+
panel of links instead of leading anywhere — declared on its own, so a site can
|
|
30
|
+
navigate from the header alone, or from both. See
|
|
31
|
+
[Navigation](./guide/navigation/) in the guide, and
|
|
32
|
+
[the configuration reference](./reference/configuration/).
|
|
28
33
|
|
|
29
|
-
|
|
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
|
+
## For a 0.3 project
|
|
34
35
|
|
|
35
|
-
|
|
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/).
|
|
56
|
-
|
|
57
|
-
## For a 0.2 project
|
|
58
|
-
|
|
59
|
-
Nothing to change: a 0.2 configuration builds as it is.
|
|
60
|
-
[Migrate from 0.2 to 0.3](./guide/migrate-from-0-2/) lists what changes on
|
|
36
|
+
Nothing to change: a 0.3 configuration builds as it is.
|
|
37
|
+
[Migrate from latest to beta](./guide/migrate-to-beta/) lists what changes on
|
|
61
38
|
its own, what to check, and what is worth turning on.
|
|
@@ -1,47 +0,0 @@
|
|
|
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 |
|