docpensieve 0.1.5 → 0.2.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 +6 -6
- package/src/commands/init.js +24 -2
- package/starter/01-guide/01-installation.md +4 -0
- package/starter/01-guide/02-first-site.md +11 -0
- package/starter/01-guide/03-writing-pages.md +30 -0
- package/starter/01-guide/04-versions.md +24 -2
- package/starter/01-guide/05-themes.md +49 -0
- package/starter/01-guide/06-deployment.md +18 -0
- package/starter/01-guide/07-migrate-from-0-1.md +57 -0
- package/starter/01-guide/index.md +2 -0
- package/starter/02-components/01-card.mdx +4 -4
- package/starter/02-components/04-tooltip.mdx +1 -1
- package/starter/02-components/08-logo-icon.mdx +1 -2
- package/starter/02-components/index.mdx +1 -1
- package/starter/03-reference/02-configuration.md +112 -31
- package/starter/03-reference/04-theme.md +10 -7
- package/starter/03-reference/05-api.md +1033 -0
- package/starter/04-architecture.md +4 -2
- package/starter/05-whats-new.md +80 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docpensieve",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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.
|
|
28
|
-
"@docpensieve/core": "0.
|
|
29
|
-
"@docpensieve/shared": "0.
|
|
30
|
-
"@docpensieve/theme": "0.
|
|
27
|
+
"@docpensieve/components": "0.2.0",
|
|
28
|
+
"@docpensieve/core": "0.2.0",
|
|
29
|
+
"@docpensieve/shared": "0.2.0",
|
|
30
|
+
"@docpensieve/theme": "0.2.0",
|
|
31
31
|
"chalk": "^6.0.0",
|
|
32
32
|
"chokidar": "^5.0.0",
|
|
33
33
|
"commander": "^15.0.0"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"url": "git+https://github.com/Juniors017/docpensieve.git",
|
|
46
46
|
"directory": "packages/cli"
|
|
47
47
|
},
|
|
48
|
-
"homepage": "https://
|
|
48
|
+
"homepage": "https://docpensieve.com",
|
|
49
49
|
"bugs": {
|
|
50
50
|
"url": "https://github.com/Juniors017/docpensieve/issues"
|
|
51
51
|
},
|
package/src/commands/init.js
CHANGED
|
@@ -56,7 +56,7 @@ const NOT_INSTALLED = new Set(['index.md', 'index.mdx', 'icons', EXAMPLES_CSS]);
|
|
|
56
56
|
const CUSTOM_CSS = fileURLToPath(new URL('../templates/custom.css', import.meta.url));
|
|
57
57
|
|
|
58
58
|
/** Where the generated configuration sends readers for every field. */
|
|
59
|
-
const DOCUMENTATION_URL = 'https://
|
|
59
|
+
const DOCUMENTATION_URL = 'https://docpensieve.com/';
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Asks a question, with a default value shown between brackets.
|
|
@@ -235,7 +235,12 @@ function renderConfig({ name, theme, siteUrl, version }) {
|
|
|
235
235
|
" // 'tailwind' compiles the utilities your pages use; 'custom' is a plain",
|
|
236
236
|
' // stylesheet with no dependency.',
|
|
237
237
|
` framework: ${quote(theme)},`,
|
|
238
|
+
" // 'class' follows the reader's system; 'dark' or 'light' keeps one scheme.",
|
|
238
239
|
" darkMode: 'class',",
|
|
240
|
+
' // A light / dark button in the header, which remembers the choice: a few',
|
|
241
|
+
' // lines of inline script in every page. false removes it, and the pages',
|
|
242
|
+
' // then load no script.',
|
|
243
|
+
' toggle: true,',
|
|
239
244
|
'',
|
|
240
245
|
' // Design tokens to override, for instance the accent colour:',
|
|
241
246
|
" // tokens: { '--dp-accent': '#008060', '--dp-radius': '0.75rem' },",
|
|
@@ -256,7 +261,9 @@ function renderConfig({ name, theme, siteUrl, version }) {
|
|
|
256
261
|
: []),
|
|
257
262
|
' },',
|
|
258
263
|
'',
|
|
259
|
-
" // 'auto': the menu follows the folders and the 01-, 02- prefixes.",
|
|
264
|
+
" // 'auto': the menu follows the folders and the 01-, 02- prefixes. To write",
|
|
265
|
+
" // it by hand, name a JSON file instead — 'sidebar.json' — read from each",
|
|
266
|
+
' // version folder.',
|
|
260
267
|
" sidebar: 'auto',",
|
|
261
268
|
'',
|
|
262
269
|
' // The shipped components — Card, Columns, Tooltip… — usable in any .mdx',
|
|
@@ -268,6 +275,21 @@ function renderConfig({ name, theme, siteUrl, version }) {
|
|
|
268
275
|
'',
|
|
269
276
|
' // Structured data (JSON-LD) generated from the frontmatter of each page.',
|
|
270
277
|
' jsonld: { enabled: true },',
|
|
278
|
+
'',
|
|
279
|
+
' // sitemap.xml of the published versions, for search engines — written',
|
|
280
|
+
' // once siteUrl is set. robots.txt joins it when the site is served at',
|
|
281
|
+
' // the root of its domain.',
|
|
282
|
+
// Commented out until siteUrl is known: written explicitly, it asks for a
|
|
283
|
+
// sitemap that cannot be built yet, and the configuration refuses it.
|
|
284
|
+
siteUrl ? ' sitemap: true,' : ' // sitemap: true,',
|
|
285
|
+
'',
|
|
286
|
+
' // RSS feed of the pages that carry a date, at the root of the site. It',
|
|
287
|
+
' // needs siteUrl.',
|
|
288
|
+
' feed: false,',
|
|
289
|
+
'',
|
|
290
|
+
' // A search field in the header, and a search page built with the site.',
|
|
291
|
+
' // Content pages load no script: the search page alone does.',
|
|
292
|
+
' search: true,',
|
|
271
293
|
'};',
|
|
272
294
|
'',
|
|
273
295
|
'// Every field is described in the reference of the DocPensieve documentation:',
|
|
@@ -99,6 +99,10 @@ 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.1, [Migrate from 0.1 to 0.2](./migrate-from-0-1/) 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
|
+
|
|
102
106
|
## Checking
|
|
103
107
|
|
|
104
108
|
```bash
|
|
@@ -95,3 +95,14 @@ online.
|
|
|
95
95
|
|
|
96
96
|
It is the check to run after any change of `baseUrl`, of folder structure or of
|
|
97
97
|
URL.
|
|
98
|
+
|
|
99
|
+
## Searching the site
|
|
100
|
+
|
|
101
|
+
Every page carries a search field in its header. It leads to the search page
|
|
102
|
+
of the version, at `/search/`, which the build writes with the site: the list
|
|
103
|
+
of every page, that a small script filters as the reader types — best matches
|
|
104
|
+
first, each with an excerpt. It is the only page to load a script of its own,
|
|
105
|
+
and without it, it stays the list of every page.
|
|
106
|
+
|
|
107
|
+
It works the same under both themes. `search: false` in the configuration
|
|
108
|
+
removes the field and the page.
|
|
@@ -65,6 +65,30 @@ docs/v1.0/
|
|
|
65
65
|
└── 01-card.mdx
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
## Writing the menu by hand
|
|
69
|
+
|
|
70
|
+
When the file tree does not give the menu you want, describe it in a JSON file
|
|
71
|
+
of the version's folder, and name it in the configuration:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
// docpensieve.config.mjs
|
|
75
|
+
sidebar: 'sidebar.json',
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
[
|
|
80
|
+
"/",
|
|
81
|
+
{ "label": "Start here", "items": ["guide/installation", "guide/first-site"] },
|
|
82
|
+
{ "auto": "components" },
|
|
83
|
+
{ "label": "Repository", "href": "https://github.com/me/my-project" }
|
|
84
|
+
]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
A page is named by its path, as in its URL. `{ "auto": "components" }` keeps
|
|
88
|
+
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. Every kind
|
|
90
|
+
of entry is in the [`sidebar` reference](../reference/configuration/).
|
|
91
|
+
|
|
68
92
|
## Internal links
|
|
69
93
|
|
|
70
94
|
Two spellings, two meanings:
|
|
@@ -92,6 +116,12 @@ An image sits next to the page and is written relatively:
|
|
|
92
116
|
Files that are not pages are copied as is into the output, at the same
|
|
93
117
|
relative place. The path is rewritten like a link.
|
|
94
118
|
|
|
119
|
+
The build reads the width and height of each image from its file — PNG, JPEG,
|
|
120
|
+
GIF, WebP or SVG — and writes them on the page: the browser keeps the room
|
|
121
|
+
before the image arrives, instead of shifting the text when it does. Every
|
|
122
|
+
image but the first loads lazily, when the reader nears it; the first, often in
|
|
123
|
+
view, keeps its normal loading.
|
|
124
|
+
|
|
95
125
|
## Components
|
|
96
126
|
|
|
97
127
|
In an `.mdx` page, the shipped components are used **without an import**:
|
|
@@ -54,6 +54,27 @@ Two rules to remember:
|
|
|
54
54
|
The switcher only appears in the header from **two** versions on: a single
|
|
55
55
|
choice is not a choice.
|
|
56
56
|
|
|
57
|
+
### Naming a version: the number or the channel
|
|
58
|
+
|
|
59
|
+
The `slug` is the address. Two conventions, and the choice is not neutral.
|
|
60
|
+
|
|
61
|
+
**The number** — `v1.0`, `v1.1` — gives each version an address that never
|
|
62
|
+
moves: a link captured today leads to the same pages in two years. But the
|
|
63
|
+
address can only carry what stays true for a whole series. `v1.0` still names
|
|
64
|
+
the documentation once `1.0.7` is out, so the URL says less than the switcher,
|
|
65
|
+
which reads the exact version.
|
|
66
|
+
|
|
67
|
+
**The channel** — `latest`, `beta` — names the role instead. The address a
|
|
68
|
+
reader shares stays right for ever: `/versions/latest/` always leads to the
|
|
69
|
+
documentation that counts, `/versions/beta/` to the one being prepared. What
|
|
70
|
+
moves is what sits behind it — on release day, `latest` becomes the new
|
|
71
|
+
version, and the one it replaces takes a numbered slug as it is archived: its
|
|
72
|
+
content freezes, so its address can freeze with it.
|
|
73
|
+
|
|
74
|
+
Neither is better. Take the number if your readers link to a precise version,
|
|
75
|
+
the channel if they link to "the documentation". DocPensieve's own
|
|
76
|
+
documentation takes the channel: its versions are `latest` and `beta`.
|
|
77
|
+
|
|
57
78
|
## 2. Opening the beta
|
|
58
79
|
|
|
59
80
|
Start from the current version, and give it its own folder:
|
|
@@ -131,9 +152,10 @@ those who use it.
|
|
|
131
152
|
|
|
132
153
|
> **The `slug` changes along with the folder, and so does the URL.**
|
|
133
154
|
> `/versions/v1.1-beta/` disappears in favour of `/versions/v1.1/`, and the
|
|
134
|
-
> external links that pointed to the beta lead nowhere any more.
|
|
155
|
+
> external links that pointed to the beta lead nowhere any more. Two ways out:
|
|
135
156
|
> keep the same slug from start to finish — `v1.1` from the start, with only
|
|
136
|
-
> the label mentioning the beta
|
|
157
|
+
> the label mentioning the beta — or name the channel rather than the number,
|
|
158
|
+
> `beta` then `latest`, which never moves. See _Naming a version_ above.
|
|
137
159
|
|
|
138
160
|
## What the build produces
|
|
139
161
|
|
|
@@ -81,6 +81,55 @@ theme: {
|
|
|
81
81
|
|
|
82
82
|
The content of `css` is appended to the produced stylesheet.
|
|
83
83
|
|
|
84
|
+
## Colour scheme
|
|
85
|
+
|
|
86
|
+
`theme.darkMode` decides which palette the reader gets. `'class'`, the default,
|
|
87
|
+
follows the reader's system; `'dark'` or `'light'` keeps one whatever the
|
|
88
|
+
system — the build sets it as a class on `<html>`.
|
|
89
|
+
|
|
90
|
+
The header also carries a button that switches between light and dark, and
|
|
91
|
+
remembers the reader's choice from page to page — a few hundred bytes of inline
|
|
92
|
+
script, the only one content pages carry. `theme.toggle: false` removes it.
|
|
93
|
+
Without JavaScript, the button does not show.
|
|
94
|
+
|
|
95
|
+
The dark palette is a set of tokens, the same under both themes. To change it,
|
|
96
|
+
redefine them in the `theme/` folder, for both ways of being dark — the
|
|
97
|
+
system's scheme, and the class that `darkMode: 'dark'` sets:
|
|
98
|
+
|
|
99
|
+
```css
|
|
100
|
+
@media (prefers-color-scheme: dark) {
|
|
101
|
+
:root:not(.light) {
|
|
102
|
+
--dp-bg: #060814;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:root.dark {
|
|
107
|
+
--dp-bg: #060814;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
<ForTheme framework="tailwind">
|
|
112
|
+
|
|
113
|
+
The `dark:` utilities of your pages follow the same rule: they apply under the
|
|
114
|
+
system's dark scheme, and always once `darkMode: 'dark'` is set.
|
|
115
|
+
|
|
116
|
+
```mdx
|
|
117
|
+
<div className="bg-white dark:bg-slate-900">…</div>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
</ForTheme>
|
|
121
|
+
<ForTheme framework="custom">
|
|
122
|
+
|
|
123
|
+
Your own classes follow it through the same two selectors:
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
:root.dark .note {
|
|
127
|
+
border-color: var(--dp-accent);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
</ForTheme>
|
|
132
|
+
|
|
84
133
|
## Layer order
|
|
85
134
|
|
|
86
135
|
Under the `tailwind` theme, the stylesheet declares its layers in this order:
|
|
@@ -122,3 +122,21 @@ result years later.
|
|
|
122
122
|
|
|
123
123
|
The branch model answers this — each compiled version on its own orphan branch,
|
|
124
124
|
with its history. See [Versions](./versions/).
|
|
125
|
+
|
|
126
|
+
## Search engines and feed readers
|
|
127
|
+
|
|
128
|
+
With `siteUrl` set, the build writes `sitemap.xml` at the root of the site —
|
|
129
|
+
every published version, a version in preparation excepted. Give its address
|
|
130
|
+
to the search engines you care about; `robots.txt` names it for them when the
|
|
131
|
+
site sits at the root of its domain.
|
|
132
|
+
|
|
133
|
+
For pages that are news rather than reference — release notes, a changelog —
|
|
134
|
+
give them a `date` and set `feed: true`: `feed.xml` then lists them, newest
|
|
135
|
+
first. The fields are in the [configuration reference](../reference/configuration/).
|
|
136
|
+
|
|
137
|
+
## What the reader downloads
|
|
138
|
+
|
|
139
|
+
The build keeps it light on its own. The stylesheet is minified — a third to
|
|
140
|
+
half lighter. Every image of a page gets its width and height, read from its
|
|
141
|
+
file, so that the text does not jump when it arrives, and all but the first
|
|
142
|
+
load lazily, when the reader nears them. There is nothing to configure.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrate from 0.1 to 0.2
|
|
3
|
+
description: Move a project from the 0.1 to the 0.2 — what changes on its own, what to check, what to turn on.
|
|
4
|
+
tags: [guide, migration]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Migrate from 0.1 to 0.2
|
|
8
|
+
|
|
9
|
+
A project on the 0.1 builds with the 0.2 as it is: every new field is
|
|
10
|
+
optional. A few things change on their own, though, and deserve a look.
|
|
11
|
+
|
|
12
|
+
## Update
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install docpensieve@latest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Through `npx` alone, `npx docpensieve` fetches the 0.2 by itself. Going back
|
|
19
|
+
is `npm install docpensieve@0.1.5`.
|
|
20
|
+
|
|
21
|
+
## What changes on its own
|
|
22
|
+
|
|
23
|
+
| What | In 0.2 |
|
|
24
|
+
| ------------------- | ----------------------------------------------------------------------------------- |
|
|
25
|
+
| Search | A field in the header, and a page at `/search/` in each version |
|
|
26
|
+
| `sitemap.xml` | Written at the root of the site as soon as `siteUrl` is set |
|
|
27
|
+
| `robots.txt` | Written with it, when the site is served at the root of its domain |
|
|
28
|
+
| The stylesheet | Minified |
|
|
29
|
+
| Images | Their width and height are written; all but the first of a page load lazily |
|
|
30
|
+
| Light / dark switch | A button in the header, remembered from page to page — a few lines of inline script |
|
|
31
|
+
| `theme.darkMode` | Now read: `'dark'` and `'light'` keep one scheme, `'class'` follows the system |
|
|
32
|
+
|
|
33
|
+
Every page now carries the few lines of the light / dark switch —
|
|
34
|
+
`theme.toggle: false` removes them — and the search page loads its own script.
|
|
35
|
+
|
|
36
|
+
## What to check
|
|
37
|
+
|
|
38
|
+
- **A page of yours at `/search/`** now stops the build: that address is the
|
|
39
|
+
search page's. Rename your page, or set `search: false`.
|
|
40
|
+
- **`theme.darkMode`** was accepted and ignored in 0.1. A value other than
|
|
41
|
+
`'class'` now takes effect — and an unknown one stops the build.
|
|
42
|
+
- **The light / dark switch** is on by default. `theme.toggle: false` removes
|
|
43
|
+
it, and with it the only script content pages carry.
|
|
44
|
+
- **Your own `robots.txt`**, if you published one next to the site, is now
|
|
45
|
+
written by the build when the site sits at the root of its domain. Set
|
|
46
|
+
`sitemap: false` to keep yours.
|
|
47
|
+
|
|
48
|
+
## What to turn on
|
|
49
|
+
|
|
50
|
+
| Field | Gives |
|
|
51
|
+
| ---------------------------- | ------------------------------------------------------------- |
|
|
52
|
+
| `sidebar: 'sidebar.json'` | A menu written by hand, in each version's folder |
|
|
53
|
+
| `feed: true` | An RSS feed of the pages that carry a `date` |
|
|
54
|
+
| `versions[].logo`, `favicon` | A logo and a favicon of the version's own — a beta told apart |
|
|
55
|
+
| `search: false` | No search at all, if the site does not need one |
|
|
56
|
+
|
|
57
|
+
Every field is in the [configuration reference](../reference/configuration/).
|
|
@@ -188,9 +188,9 @@ carrying the caption.
|
|
|
188
188
|
<Card className="h-full text-center">
|
|
189
189
|
<CardBody>
|
|
190
190
|
<div className="text-4xl font-semibold text-indigo-600">0</div>
|
|
191
|
-
<div className="text-sm">bytes of JavaScript</div>
|
|
191
|
+
<div className="text-sm">bytes of JavaScript runtime</div>
|
|
192
192
|
</CardBody>
|
|
193
|
-
<CardFooter>on every
|
|
193
|
+
<CardFooter>on every page</CardFooter>
|
|
194
194
|
</Card>
|
|
195
195
|
</Column>
|
|
196
196
|
<Column span={4}>
|
|
@@ -221,9 +221,9 @@ carrying the caption.
|
|
|
221
221
|
<Card className="full-height centered">
|
|
222
222
|
<CardBody>
|
|
223
223
|
<div className="figure">0</div>
|
|
224
|
-
<div className="small">bytes of JavaScript</div>
|
|
224
|
+
<div className="small">bytes of JavaScript runtime</div>
|
|
225
225
|
</CardBody>
|
|
226
|
-
<CardFooter>on every
|
|
226
|
+
<CardFooter>on every page</CardFooter>
|
|
227
227
|
</Card>
|
|
228
228
|
</Column>
|
|
229
229
|
<Column span={4}>
|
|
@@ -93,7 +93,7 @@ The shipped components avoid that clipping wherever they can — a `Card` rounds
|
|
|
93
93
|
the corners of its image one by one rather than clipping its content.
|
|
94
94
|
|
|
95
95
|
The bubble does not close with the Escape key: listening for it would take a
|
|
96
|
-
script, and
|
|
96
|
+
script, and components load none. It disappears when the pointer or the focus
|
|
97
97
|
leaves the term.
|
|
98
98
|
|
|
99
99
|
A `Tooltip` without text stops the build: a hover with no effect goes
|
|
@@ -146,5 +146,4 @@ folder: each one stops the build, naming the expected path. A missing icon
|
|
|
146
146
|
would otherwise leave an empty box that nobody notices.
|
|
147
147
|
|
|
148
148
|
The scripts and event handlers present in a file are removed before inlining.
|
|
149
|
-
|
|
150
|
-
introduce any.
|
|
149
|
+
A component loads no JavaScript, and this one is not going to introduce any.
|
|
@@ -75,7 +75,7 @@ changes the examples too.
|
|
|
75
75
|
|
|
76
76
|
## Without JavaScript
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
No component loads a script. Whatever needs interaction therefore goes
|
|
79
79
|
through native elements or through CSS: `details` for expanding, a link for
|
|
80
80
|
moving, `animation-timeline` for appearing on scroll.
|
|
81
81
|
|
|
@@ -49,22 +49,25 @@ can change.
|
|
|
49
49
|
|
|
50
50
|
## The fields
|
|
51
51
|
|
|
52
|
-
| Field | Default | Effect
|
|
53
|
-
| ------------------ | ------------------- |
|
|
54
|
-
| `projectName` | `'Documentation'` | Name shown in the header and in the JSON-LD
|
|
55
|
-
| `siteUrl` | `''` | Public URL. Used for the `canonical` and the JSON-LD
|
|
56
|
-
| `baseUrl` | `'/'` | Deployment prefix. Derived from `siteUrl` when omitted
|
|
57
|
-
| `outDir` | `'dist'` | Output folder, relative to the root
|
|
58
|
-
| `versions` | `[]` | At least one entry
|
|
59
|
-
| `theme` | see below | Styling
|
|
60
|
-
| `sidebar` | `'auto'` | `'auto'`: the
|
|
61
|
-
| `globalComponents` | `true` | Shipped components available without an import
|
|
62
|
-
| `scrollToTop` | `true` | Back-to-top button on every page
|
|
63
|
-
| `jsonld` | `{ enabled: true }` | Structured data
|
|
64
|
-
| `lang` | `'en'` | Language of the document, in `<html lang>`. The shell's labels stay English
|
|
65
|
-
| `logo` | `''` | Image beside the project name, in the header
|
|
66
|
-
| `favicon` | `''` | Icon of the browser tab: `.ico`, `.png` or `.svg`
|
|
67
|
-
| `socialImage` | `''` | Preview of a shared page. Needs `siteUrl`
|
|
52
|
+
| Field | Default | Effect |
|
|
53
|
+
| ------------------ | ------------------- | ---------------------------------------------------------------------------------- |
|
|
54
|
+
| `projectName` | `'Documentation'` | Name shown in the header and in the JSON-LD |
|
|
55
|
+
| `siteUrl` | `''` | Public URL. Used for the `canonical` and the JSON-LD |
|
|
56
|
+
| `baseUrl` | `'/'` | Deployment prefix. Derived from `siteUrl` when omitted |
|
|
57
|
+
| `outDir` | `'dist'` | Output folder, relative to the root |
|
|
58
|
+
| `versions` | `[]` | At least one entry |
|
|
59
|
+
| `theme` | see below | Styling |
|
|
60
|
+
| `sidebar` | `'auto'` | `'auto'`: the menu follows the file tree. Or a `.json` file of each version folder |
|
|
61
|
+
| `globalComponents` | `true` | Shipped components available without an import |
|
|
62
|
+
| `scrollToTop` | `true` | Back-to-top button on every page |
|
|
63
|
+
| `jsonld` | `{ enabled: true }` | Structured data |
|
|
64
|
+
| `lang` | `'en'` | Language of the document, in `<html lang>`. The shell's labels stay English |
|
|
65
|
+
| `logo` | `''` | Image beside the project name, in the header |
|
|
66
|
+
| `favicon` | `''` | Icon of the browser tab: `.ico`, `.png` or `.svg` |
|
|
67
|
+
| `socialImage` | `''` | Preview of a shared page. Needs `siteUrl` |
|
|
68
|
+
| `sitemap` | `true` | `sitemap.xml` of the published versions, once `siteUrl` is set |
|
|
69
|
+
| `feed` | `false` | RSS feed of the dated pages. Needs `siteUrl` |
|
|
70
|
+
| `search` | `true` | Search field in the header, and a search page built with the site |
|
|
68
71
|
|
|
69
72
|
## Images
|
|
70
73
|
|
|
@@ -87,6 +90,45 @@ version, under `assets/`, so that a version stays whole on its own branch.
|
|
|
87
90
|
|
|
88
91
|
A declared image that does not exist stops the build, naming the field.
|
|
89
92
|
|
|
93
|
+
## Sitemap and feed
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
siteUrl: 'https://example.com',
|
|
97
|
+
sitemap: true, // the default
|
|
98
|
+
feed: true,
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Once `siteUrl` is set, the build writes `sitemap.xml` at the root of the site:
|
|
102
|
+
every page of every version, except a version in preparation, whose pages
|
|
103
|
+
carry `noindex`. Each page is dated by its `modified` frontmatter, or failing
|
|
104
|
+
that its `date`. `sitemap: false` turns it off.
|
|
105
|
+
|
|
106
|
+
`robots.txt` joins it when the site is served at the root of its domain.
|
|
107
|
+
Search engines only read that file there: under a sub-path, it would be
|
|
108
|
+
written for nobody — declare the sitemap to them directly.
|
|
109
|
+
|
|
110
|
+
`feed: true` writes `feed.xml`, an RSS feed of the pages of the current version
|
|
111
|
+
that carry a `date`, newest first, and every page announces it in its head.
|
|
112
|
+
It is off by default: most documentation pages carry no date.
|
|
113
|
+
|
|
114
|
+
Both list absolute addresses: asked for without `siteUrl`, they stop the build.
|
|
115
|
+
|
|
116
|
+
## Search
|
|
117
|
+
|
|
118
|
+
`search: true`, the default, puts a search field in the header and builds a
|
|
119
|
+
search page in each version, at `/search/`. The build writes the index of the
|
|
120
|
+
version — the plain text of every page — and the search page already lists
|
|
121
|
+
every page with its description.
|
|
122
|
+
|
|
123
|
+
The field is a plain form that leads to that page: it needs no script. The
|
|
124
|
+
search page loads one of its own, of a few kilobytes, which filters
|
|
125
|
+
the list as you type, best matches first, with an excerpt of each. Without
|
|
126
|
+
JavaScript, the page stays the full list of pages.
|
|
127
|
+
|
|
128
|
+
The search page is kept out of search engines (`noindex`) and out of the
|
|
129
|
+
sitemap. A page of your own at `/search/` would take its place: the build
|
|
130
|
+
refuses it, and `search: false` frees the address.
|
|
131
|
+
|
|
90
132
|
## `versions`
|
|
91
133
|
|
|
92
134
|
```js
|
|
@@ -96,14 +138,16 @@ versions: [
|
|
|
96
138
|
],
|
|
97
139
|
```
|
|
98
140
|
|
|
99
|
-
| Field | Role
|
|
100
|
-
| ------------ |
|
|
101
|
-
| `slug` | URL and branch identifier
|
|
102
|
-
| `name` | Label shown in the switcher
|
|
103
|
-
| `folder` | Source folder, relative to the root
|
|
104
|
-
| `current` | Version served by default. At most one
|
|
105
|
-
| `archived` | Version kept but no longer maintained. Banner, but stays indexed
|
|
106
|
-
| `prerelease` | Version in preparation. Banner **and** `noindex`
|
|
141
|
+
| Field | Role |
|
|
142
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
143
|
+
| `slug` | URL and branch identifier. A number (`v1.0`) freezes the address; a channel (`latest`, `beta`) keeps it right as versions move |
|
|
144
|
+
| `name` | Label shown in the switcher |
|
|
145
|
+
| `folder` | Source folder, relative to the root |
|
|
146
|
+
| `current` | Version served by default. At most one |
|
|
147
|
+
| `archived` | Version kept but no longer maintained. Banner, but stays indexed |
|
|
148
|
+
| `prerelease` | Version in preparation. Banner **and** `noindex` |
|
|
149
|
+
| `logo` | This version's logo, instead of the project's — a beta told apart at a glance |
|
|
150
|
+
| `favicon` | This version's favicon, instead of the project's |
|
|
107
151
|
|
|
108
152
|
## `theme`
|
|
109
153
|
|
|
@@ -117,13 +161,14 @@ theme: {
|
|
|
117
161
|
},
|
|
118
162
|
```
|
|
119
163
|
|
|
120
|
-
| Field | Effect
|
|
121
|
-
| ----------- |
|
|
122
|
-
| `framework` | `'tailwind'` or `'custom'`
|
|
123
|
-
| `darkMode` |
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
164
|
+
| Field | Effect |
|
|
165
|
+
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
166
|
+
| `framework` | `'tailwind'` or `'custom'` |
|
|
167
|
+
| `darkMode` | `'class'` follows the reader's system; `'dark'` or `'light'` keeps one scheme |
|
|
168
|
+
| `toggle` | On by default: a light / dark button in the header, remembered from page to page — a few lines of inline script. `false` removes it |
|
|
169
|
+
| `tokens` | Redefined `--dp-*` tokens |
|
|
170
|
+
| `css` | CSS appended to the produced stylesheet |
|
|
171
|
+
| `source` | Stylesheet handed to the utility compiler |
|
|
127
172
|
|
|
128
173
|
The available tokens are listed in [Themes](../guide/themes/).
|
|
129
174
|
|
|
@@ -132,6 +177,42 @@ Longer rules go in the `theme/` folder, at the root of the project: every
|
|
|
132
177
|
`docpensieve dev` picks up every change. Under the `custom` theme, `init`
|
|
133
178
|
starts it with `theme/custom.css`.
|
|
134
179
|
|
|
180
|
+
## `sidebar`
|
|
181
|
+
|
|
182
|
+
`'auto'` builds the menu from the file tree: folders become categories, and the
|
|
183
|
+
`01-`, `02-` prefixes set the order. To write it by hand, name a JSON file:
|
|
184
|
+
|
|
185
|
+
```js
|
|
186
|
+
sidebar: 'sidebar.json',
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
It is read from **each version's folder** — `docs/v1.0/sidebar.json` — since
|
|
190
|
+
each version has its own pages. It holds an array of entries, kept in the order
|
|
191
|
+
written:
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
[
|
|
195
|
+
"/",
|
|
196
|
+
{ "label": "Guide", "page": "guide", "items": ["guide/installation", "guide/first-site"] },
|
|
197
|
+
{ "page": "reference/cli", "label": "Commands" },
|
|
198
|
+
{ "auto": "docpensieve" },
|
|
199
|
+
{ "label": "Repository", "href": "https://github.com/me/my-project" }
|
|
200
|
+
]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
| Entry | What it gives |
|
|
204
|
+
| ------------------------------- | ------------------------------------------------------------------------------- |
|
|
205
|
+
| `"guide/installation"` | A page, by its path within the version, as in its URL — `"/"` for the home page |
|
|
206
|
+
| `{ "page", "label" }` | The same page, with a label of its own |
|
|
207
|
+
| `{ "label", "items", "page"? }` | A category, clickable when it names a page |
|
|
208
|
+
| `{ "label", "href" }` | A link outside the site |
|
|
209
|
+
| `{ "auto": "folder" }` | The automatic menu of a folder: the DocPensieve section keeps its own this way |
|
|
210
|
+
|
|
211
|
+
A page left out stays published: it is only absent from the menu. A path that
|
|
212
|
+
names no page, a page listed twice, or an entry of no known kind stops the
|
|
213
|
+
build, naming the file and the paths close to the one written. The file itself
|
|
214
|
+
is not published.
|
|
215
|
+
|
|
135
216
|
## `baseUrl`, and why you rarely write it
|
|
136
217
|
|
|
137
218
|
A `siteUrl` with a sub-path already gives it: `https://example.com/my-project`
|
|
@@ -25,13 +25,14 @@ theme: {
|
|
|
25
25
|
},
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
| Field | Default | Effect
|
|
29
|
-
| ----------- | ------------------------ |
|
|
30
|
-
| `framework` | `'tailwind'` | `'tailwind'` or `'custom'`
|
|
31
|
-
| `darkMode` | `'class'` |
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
28
|
+
| Field | Default | Effect |
|
|
29
|
+
| ----------- | ------------------------ | --------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `framework` | `'tailwind'` | `'tailwind'` or `'custom'` |
|
|
31
|
+
| `darkMode` | `'class'` | `'class'`: the reader's system, unless a class on `<html>` decides. `'dark'` or `'light'` sets that class |
|
|
32
|
+
| `toggle` | `true` | A light / dark button in the header, remembered from page to page |
|
|
33
|
+
| `tokens` | — | Redefined `--dp-*` tokens, merged with the provider's |
|
|
34
|
+
| `css` | `''` | CSS appended to the produced stylesheet |
|
|
35
|
+
| `source` | `@import "tailwindcss";` | Stylesheet handed to the utility compiler |
|
|
35
36
|
|
|
36
37
|
`source` only concerns the `tailwind` provider: it is the entry stylesheet it
|
|
37
38
|
compiles. Replacing it lets you add directives — a `@theme` block, for
|
|
@@ -98,6 +99,8 @@ the `dp-*` class below.
|
|
|
98
99
|
| `footer` | `dp-footer` | Page footer |
|
|
99
100
|
| `scrollTop` | `dp-scroll-top` | Back-to-top button |
|
|
100
101
|
| `scrollTopIcon` | `dp-scroll-top-icon` | Arrow of that button |
|
|
102
|
+
| `search` | `dp-search` | Search field of the header |
|
|
103
|
+
| `schemeToggle` | `dp-scheme-toggle` | Light / dark button of the header |
|
|
101
104
|
|
|
102
105
|
A slot can carry **variants**, suffixed `--variant`: `column` gives
|
|
103
106
|
`dp-column--span-8`, `skill` gives `dp-skill--circle`.
|