docpensieve 0.3.0-beta.2 → 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 +16 -3
- package/starter/01-guide/01-installation.md +3 -3
- package/starter/01-guide/03-writing-pages.md +26 -5
- package/starter/01-guide/{07-migrate-to-beta.md → 07-migrate-from-0-2.md} +18 -8
- package/starter/03-reference/02-configuration.md +32 -4
- package/starter/03-reference/03-frontmatter.md +1 -1
- package/starter/03-reference/04-theme.md +13 -0
- package/starter/05-whats-new.md +27 -6
- /package/starter/01-guide/{05-themes.md → 05-themes.mdx} +0 -0
- /package/starter/01-guide/{index.md → index.mdx} +0 -0
- /package/starter/03-reference/{index.md → index.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));
|
|
@@ -271,6 +280,10 @@ function renderConfig({ name, theme, siteUrl, version }) {
|
|
|
271
280
|
' // names its frontmatter gives, without the rest.',
|
|
272
281
|
" authors: '',",
|
|
273
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
|
+
'',
|
|
274
287
|
' // The shipped components — Card, Columns, Tooltip… — usable in any .mdx',
|
|
275
288
|
' // page without an import. false removes them, to use your own names.',
|
|
276
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,8 +26,9 @@ 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
|
|
|
@@ -62,7 +63,8 @@ Then name that file in the configuration: `authors: 'authors.json'`. It is
|
|
|
62
63
|
read **in each version folder**, as the menu is — a biography corrected in
|
|
63
64
|
the version being written leaves the published one alone. The file itself is
|
|
64
65
|
not published; the avatars are, and are measured at the build so that the
|
|
65
|
-
text does not jump when they arrive.
|
|
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.
|
|
66
68
|
|
|
67
69
|
A key nobody describes is shown as written, which is what lets a project name
|
|
68
70
|
its authors before describing them. The description also feeds the page data:
|
|
@@ -105,6 +107,23 @@ docs/v1.0/
|
|
|
105
107
|
└── 01-card.mdx
|
|
106
108
|
```
|
|
107
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
|
+
|
|
108
127
|
## Writing the menu by hand
|
|
109
128
|
|
|
110
129
|
When the file tree does not give the menu you want, describe it in a JSON file
|
|
@@ -126,8 +145,10 @@ sidebar: 'sidebar.json',
|
|
|
126
145
|
|
|
127
146
|
A page is named by its path, as in its URL. `{ "auto": "components" }` keeps
|
|
128
147
|
the automatic menu of a folder — the DocPensieve section stays whole that way.
|
|
129
|
-
A page the file leaves out is still published, only off the menu
|
|
130
|
-
|
|
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/).
|
|
131
152
|
|
|
132
153
|
## Internal links
|
|
133
154
|
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Migrate from
|
|
3
|
-
description: Move a project from the
|
|
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
4
|
tags: [guide, migration]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Migrate from
|
|
7
|
+
# Migrate from 0.2 to 0.3
|
|
8
8
|
|
|
9
|
-
A project on the
|
|
10
|
-
every new field is optional.
|
|
9
|
+
A project on the 0.2 builds with the 0.3 as it is: every new field is optional.
|
|
11
10
|
|
|
12
11
|
## Update
|
|
13
12
|
|
|
14
13
|
```bash
|
|
15
|
-
npm install docpensieve@
|
|
14
|
+
npm install docpensieve@latest
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
Through `npx` alone, `npx docpensieve
|
|
19
|
-
`npm install docpensieve@
|
|
17
|
+
Through `npx` alone, `npx docpensieve` fetches the 0.3 by itself. Going back is
|
|
18
|
+
`npm install docpensieve@0.2.0`.
|
|
20
19
|
|
|
21
20
|
## What changes on its own
|
|
22
21
|
|
|
@@ -29,6 +28,17 @@ read by the sitemap and the page data without ever being shown. They are now
|
|
|
29
28
|
shown, so a page that carries them gains a block it did not have. A page that
|
|
30
29
|
carries none of them looks exactly as before.
|
|
31
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
|
+
|
|
32
42
|
## What to turn on
|
|
33
43
|
|
|
34
44
|
| Field | Gives |
|
|
@@ -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 |
|
|
@@ -187,12 +189,37 @@ Names a JSON file **read in each version folder**, describing the authors a
|
|
|
187
189
|
page names in its frontmatter: a name, a biography, an avatar, a link.
|
|
188
190
|
|
|
189
191
|
Empty by default, and then a page still shows the names it gives, without the
|
|
190
|
-
rest: the file enriches, it does not command.
|
|
191
|
-
|
|
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.
|
|
192
196
|
|
|
193
197
|
The file is not published. The avatars are, their path starting at the version
|
|
194
198
|
folder so that they travel with it.
|
|
195
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
|
+
|
|
196
223
|
## `sidebar`
|
|
197
224
|
|
|
198
225
|
`'auto'` builds the menu from the file tree: folders become categories, and the
|
|
@@ -203,8 +230,9 @@ sidebar: 'sidebar.json',
|
|
|
203
230
|
```
|
|
204
231
|
|
|
205
232
|
It is read from **each version's folder** — `docs/v1.0/sidebar.json` — since
|
|
206
|
-
each version has its own pages.
|
|
207
|
-
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:
|
|
208
236
|
|
|
209
237
|
```json
|
|
210
238
|
[
|
|
@@ -45,7 +45,7 @@ jsonld:
|
|
|
45
45
|
| `date` | Publication date |
|
|
46
46
|
| `modified` | Last modification date. Default: the publication date. Shown in the byline |
|
|
47
47
|
| `authors` | Authors of the page, by name or by key of the version's author file |
|
|
48
|
-
| `tags` |
|
|
48
|
+
| `tags` | Shown at the bottom of the page, and carried over as JSON-LD `keywords` |
|
|
49
49
|
| `preview` | Image of the page. The path is resolved like a link |
|
|
50
50
|
| `draft` | `true` keeps the page out of the output |
|
|
51
51
|
| `layout` | `doc` (default) or `home` |
|
|
@@ -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`.
|
package/starter/05-whats-new.md
CHANGED
|
@@ -6,15 +6,14 @@ 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
18
|
### Authors at the head of a page
|
|
20
19
|
|
|
@@ -33,8 +32,30 @@ into a grid of clickable cards — title, description, image, number of pages,
|
|
|
33
32
|
update date — instead of an index list written by hand, which goes stale at
|
|
34
33
|
the first page renamed. See [Cards](./components/cards/).
|
|
35
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/).
|
|
56
|
+
|
|
36
57
|
## For a 0.2 project
|
|
37
58
|
|
|
38
59
|
Nothing to change: a 0.2 configuration builds as it is.
|
|
39
|
-
[Migrate from
|
|
60
|
+
[Migrate from 0.2 to 0.3](./guide/migrate-from-0-2/) lists what changes on
|
|
40
61
|
its own, what to check, and what is worth turning on.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|