docpensieve 0.5.0-beta.4 → 0.5.0-beta.5
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/starter/01-guide/05-themes.mdx +4 -2
- package/starter/01-guide/06-deployment.md +34 -0
- package/starter/01-guide/07-migrate-to-beta.md +12 -0
- package/starter/01-guide/10-languages.md +17 -0
- package/starter/02-components/03-time-timer.mdx +5 -0
- package/starter/05-whats-new.md +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docpensieve",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.5",
|
|
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.5.0-beta.
|
|
28
|
-
"@docpensieve/core": "0.5.0-beta.
|
|
29
|
-
"@docpensieve/shared": "0.5.0-beta.
|
|
30
|
-
"@docpensieve/theme": "0.5.0-beta.
|
|
27
|
+
"@docpensieve/components": "0.5.0-beta.5",
|
|
28
|
+
"@docpensieve/core": "0.5.0-beta.5",
|
|
29
|
+
"@docpensieve/shared": "0.5.0-beta.5",
|
|
30
|
+
"@docpensieve/theme": "0.5.0-beta.5",
|
|
31
31
|
"chalk": "^6.0.0",
|
|
32
32
|
"chokidar": "^5.0.0",
|
|
33
33
|
"commander": "^15.0.0"
|
|
@@ -122,8 +122,10 @@ follows the reader's system; `'dark'` or `'light'` keeps one whatever the
|
|
|
122
122
|
system — the build sets it as a class on `<html>`.
|
|
123
123
|
|
|
124
124
|
The header also carries a button that switches between light and dark, and
|
|
125
|
-
remembers the reader's choice from page to page — a few hundred bytes of
|
|
126
|
-
script, the only
|
|
125
|
+
remembers the reader's choice from page to page — a few hundred bytes of
|
|
126
|
+
script written into the page, the only script that is not a file of the site.
|
|
127
|
+
A Content-Security-Policy allows it by its hash, which the
|
|
128
|
+
[deployment guide](./deployment/) gives. `theme.toggle: false` removes it.
|
|
127
129
|
Without JavaScript, the button does not show.
|
|
128
130
|
|
|
129
131
|
The dark palette is a set of tokens, the same under both themes. To change it,
|
|
@@ -170,3 +170,37 @@ The build keeps it light on its own. The stylesheet is minified — a third to
|
|
|
170
170
|
half lighter. Every image of a page gets its width and height, read from its
|
|
171
171
|
file, so that the text does not jump when it arrives, and all but the first
|
|
172
172
|
load lazily, when the reader nears them. There is nothing to configure.
|
|
173
|
+
|
|
174
|
+
## A Content-Security-Policy
|
|
175
|
+
|
|
176
|
+
A Content-Security-Policy tells the browser what a page may load and run, so
|
|
177
|
+
that a script slipped into it is refused. A host that lets you set response
|
|
178
|
+
headers can send one with the site, and the pages hold up under a strict one —
|
|
179
|
+
one line in the header, split here to be read:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
default-src 'self';
|
|
183
|
+
script-src 'self' 'sha256-9V5TjnZ1QZI4gqywFKZk0OWiHyt6/BX2XWMibvI5UKc=' 'sha256-uoMvfl2Wu3fqzsh38hLYURHzlNXf65BbRUVEBM5sots=';
|
|
184
|
+
style-src 'self'; style-src-attr 'unsafe-inline';
|
|
185
|
+
object-src 'none'; base-uri 'self'; frame-ancestors 'none'
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- **The two hashes** are the two scripts written into the page by the light /
|
|
189
|
+
dark button: one applies the reader's choice before the first paint, the
|
|
190
|
+
other runs the button. Their words come from the button itself, in the
|
|
191
|
+
language of the page, so the scripts are the same text on every page of
|
|
192
|
+
every site: the hashes do not change with your content. They change with the
|
|
193
|
+
tool — after an update, a refused script names in the browser console the
|
|
194
|
+
hash it expected. `theme.toggle: false` removes both scripts, and the hashes
|
|
195
|
+
with them.
|
|
196
|
+
- **Every other script is a file of the site** — the client file of the
|
|
197
|
+
version, the search script and its index — which `'self'` covers.
|
|
198
|
+
- **`style-src-attr 'unsafe-inline'`** is the one allowance. The code
|
|
199
|
+
highlighter colours each word with a `style` attribute, and some components
|
|
200
|
+
size themselves that way. It lets style attributes through, not `<style>`
|
|
201
|
+
elements, and a style attribute runs no code.
|
|
202
|
+
|
|
203
|
+
This policy was checked in a browser against the pages of this site: search,
|
|
204
|
+
copy buttons, calendars and the light / dark button all work, and nothing is
|
|
205
|
+
refused. If your pages load anything from another address — an image, a font —
|
|
206
|
+
add that address to the matching directive.
|
|
@@ -40,6 +40,18 @@ npx docpensieve check
|
|
|
40
40
|
every other block.
|
|
41
41
|
- **An error keeps its hint.** An error the tool raises while a page compiles
|
|
42
42
|
no longer comes out as a generic syntax complaint.
|
|
43
|
+
- **A setting that did nothing now stops the build.** `copyCode: 'yes'` turned
|
|
44
|
+
the button off in silence, and a `TimeTimer` with a `start` but no
|
|
45
|
+
`duration` hid its content; both now name what is wrong. Build once after
|
|
46
|
+
updating: that is where it shows.
|
|
47
|
+
- **`ScrollToTop`, `Menu` and the light / dark button speak the language of
|
|
48
|
+
the page** when you give them no label of your own. A project that writes
|
|
49
|
+
its own words in `ui` gets two more to write: `switchToLight` and
|
|
50
|
+
`switchToDark`.
|
|
51
|
+
- **A reader stays in their language from one version to another.** The
|
|
52
|
+
version switcher, the notice of a beta and the links of the header led a
|
|
53
|
+
French reader to the English pages; they now lead to the French ones
|
|
54
|
+
wherever they exist.
|
|
43
55
|
|
|
44
56
|
## What is worth turning on
|
|
45
57
|
|
|
@@ -69,6 +69,23 @@ Nothing already published moves, which is the point: a link shared last year
|
|
|
69
69
|
still leads where it led. The translation lives **inside** the version, so a
|
|
70
70
|
version is still one folder, one orphan branch, one stylesheet.
|
|
71
71
|
|
|
72
|
+
## Moving from one version to another
|
|
73
|
+
|
|
74
|
+
The version switcher, the notice on a beta or an archive, and the links of the
|
|
75
|
+
header lead to another version — in the reader's language when that version
|
|
76
|
+
has the page in it, in the language of the site when it does not. A French
|
|
77
|
+
reader of the beta who follows its notice lands on the French pages of the
|
|
78
|
+
current version; a version never translated opens in the language it was
|
|
79
|
+
written in, rather than on an address that leads nowhere.
|
|
80
|
+
|
|
81
|
+
The links you write in a page stay in their language by themselves, as long as
|
|
82
|
+
they are written from the page. A link that starts from the root of the
|
|
83
|
+
version — `/guide/install/` — leads to the French page from a French page. A
|
|
84
|
+
relative link climbs from the folder of its file, and the folders of a
|
|
85
|
+
translation mirror those of the site language: write it as the twin page
|
|
86
|
+
writes it. One level too many and it leaves the language, which `check` cannot
|
|
87
|
+
see — the English page it lands on exists.
|
|
88
|
+
|
|
72
89
|
## A page nobody translated
|
|
73
90
|
|
|
74
91
|
It does not exist in that language. It is absent from the menu of that
|
|
@@ -119,6 +119,11 @@ integration, whose time zone is not yours.
|
|
|
119
119
|
A misspelt duration stops the build, and so does an invalid date. The message
|
|
120
120
|
names the faulty value and recalls the expected format.
|
|
121
121
|
|
|
122
|
+
So does a timer that names no period: no `date` at all, a `start` without its
|
|
123
|
+
`duration`, a `duration` beside a `date`, or a `date` and a `start` together.
|
|
124
|
+
Each of these used to show nothing, without a word — a block gone from the
|
|
125
|
+
page, and nothing to say why.
|
|
126
|
+
|
|
122
127
|
Announcing a release is what this is usually for, and [Versions](../guide/versions/)
|
|
123
128
|
covers the rest of that cycle — the banner a prerelease carries on its own,
|
|
124
129
|
and the day the two tracks swap.
|
package/starter/05-whats-new.md
CHANGED
|
@@ -95,6 +95,16 @@ default, and it needs no `siteUrl`.
|
|
|
95
95
|
|
|
96
96
|
[The field](./reference/configuration/)
|
|
97
97
|
|
|
98
|
+
### A strict Content-Security-Policy
|
|
99
|
+
|
|
100
|
+
The light / dark button no longer writes its words into its script: they come
|
|
101
|
+
from the page, in its language — a French page used to name the button in
|
|
102
|
+
English to a screen reader. Its two scripts are then the same text on every
|
|
103
|
+
page, and a Content-Security-Policy allows them by their hash. The deployment
|
|
104
|
+
guide gives a strict policy, checked in a browser against this site.
|
|
105
|
+
|
|
106
|
+
[The policy](./guide/deployment/)
|
|
107
|
+
|
|
98
108
|
## For a 0.4 project
|
|
99
109
|
|
|
100
110
|
Nothing to change: a 0.4 configuration builds as it is, and a site already in
|