docpensieve 0.3.0-beta.2 → 0.4.0-beta.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docpensieve",
3
- "version": "0.3.0-beta.2",
3
+ "version": "0.4.0-beta.1",
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.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",
27
+ "@docpensieve/components": "0.4.0-beta.1",
28
+ "@docpensieve/core": "0.4.0-beta.1",
29
+ "@docpensieve/shared": "0.4.0-beta.1",
30
+ "@docpensieve/theme": "0.4.0-beta.1",
31
31
  "chalk": "^6.0.0",
32
32
  "chokidar": "^5.0.0",
33
33
  "commander": "^15.0.0"
@@ -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 belong to
51
- * DocPensieve's own site, and the examples' stylesheet has a place of its own.
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(['index.md', 'index.mdx', 'icons', EXAMPLES_CSS]);
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,7 +99,7 @@ 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 latest to beta](./migrate-to-beta/) says
102
+ Coming from the 0.3, [Migrate from latest to beta](./migrate-to-beta/) says
103
103
  what changes on its own and what to check first. To try this beta, install
104
104
  `docpensieve@beta`, or run `npx docpensieve@beta` alone.
105
105
 
@@ -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. Everything is optional:
30
- without `title`, the project name stands in.
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. Every kind
130
- of entry is in the [`sidebar` reference](../reference/configuration/).
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,12 +1,12 @@
1
1
  ---
2
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.
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
4
  tags: [guide, migration]
5
5
  ---
6
6
 
7
7
  # Migrate from latest to beta
8
8
 
9
- A project on the latest version — the 0.2 — builds with the 0.3 beta as it is:
9
+ A project on the latest version — the 0.3 — builds with the 0.4 beta as it is:
10
10
  every new field is optional.
11
11
 
12
12
  ## Update
@@ -20,18 +20,5 @@ Through `npx` alone, `npx docpensieve@beta` runs the beta. Going back is
20
20
 
21
21
  ## What changes on its own
22
22
 
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 |
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.
@@ -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. Named but missing, it stops the
191
- build leaving every biography out without a word would be worse.
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. It holds an array of entries, kept in the order
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` | Keywords, carried over as `keywords` |
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`.
@@ -1,13 +1,13 @@
1
1
  ---
2
- title: What's new in 0.3
3
- description: What the 0.3 brings, and what it changes for a 0.2 project.
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.3
7
+ # What's new in 0.4
8
8
 
9
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.2, documented in the
10
+ while the version installed by default stays the 0.3, documented in the
11
11
  `latest` pages of this site:
12
12
 
13
13
  ```bash
@@ -16,25 +16,13 @@ npx docpensieve@beta init my-site
16
16
 
17
17
  ## Already there
18
18
 
19
- ### Authors at the head of a page
19
+ Nothing yet: the 0.4 has just opened, and its pages are still those of the 0.3.
20
+ Each feature is announced here as it lands, with a link to the guide and to the
21
+ reference — this page announces, it is never the only place something is
22
+ written.
20
23
 
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.
24
+ ## For a 0.3 project
27
25
 
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/).
35
-
36
- ## For a 0.2 project
37
-
38
- Nothing to change: a 0.2 configuration builds as it is.
26
+ Nothing to change: a 0.3 configuration builds as it is.
39
27
  [Migrate from latest to beta](./guide/migrate-to-beta/) lists what changes on
40
28
  its own, what to check, and what is worth turning on.
File without changes
File without changes