Skip to content
DocPensieve
Documentation menu

What's new in 0.5

This version is in preparation. Its betas go out under the npm tag beta, while the version installed by default stays the 0.4, documented in the latest pages of this site:

npx docpensieve@beta init my-site

Each feature is announced here as it lands, with a link to the guide and to the reference: this page announces, it is never the only place something is written.

Already there

The development server stays on your machine

dev and serve now listen on this machine only. They used to listen on every interface, so anyone on the same network could read the site being written, drafts included. --host 0.0.0.0 opens it on purpose — to look at it from a phone — and the command says so when it starts.

The commands

A banner, and a calendar

Hero holds the head of a page — a name, a sentence, a row of ways in — so that it is a component rather than a div and a pile of classes.

Calendar draws the months your events fall on, each event on its day. Every month is in the page: a reader with no script gets them stacked and readable, and the client file folds them into one with two arrows.

Hero · Calendar

A button that copies a block of code

copyCode: true puts a copy button on every block of code. It is the first thing a DocPensieve page asks a reader to load, so it is off until you ask for it — and then the behaviour is written once per version, shared by every page and every language, and loaded only by the pages that hold code. About two kilobytes, compressed; no framework, no hydration.

This is the rule of no script at all giving way to one that can be measured: a page loads only what it uses. The field

A code block that names a file

Snippet shows a real file of your project, read when the page is generated. An example written by hand is a copy, and a copy stops being true the day the code changes, with nothing to report it. A range of lines or a #region marker keeps part of the file; collapsed folds a long one into a details, still without a script.

<Snippet source="src/index.js" region="guard" />

The idea comes from Christophe Avonture.

The component

init asks about languages

init now asks whether the site will be in several languages, and sets the answer up: the folder beside your pages, translations written out in the configuration, and a home page in that language to start from. The second sample page is deliberately left untranslated, so that the menu shows what an untranslated page does — nothing, in that language.

npx docpensieve init my-site --translation fr

A code is a BCP 47 one: fr, pt-BR, zh-Hans. French and English ship with their wording for the shell; any other language keeps the English wording until the ui field gives it its own.

Languages · The init options

Pages a program can read

llms: true writes llms.txt at the root of the site — the project, then a link to every page of the current version — and a Markdown copy beside each page, index.html.md, that its head names. An assistant asked about your project reads the text you wrote rather than prying it out of the HTML. Off by default, and it needs no siteUrl.

The field

A strict Content-Security-Policy

The light / dark button no longer writes its words into its script: they come from the page, in its language — a French page used to name the button in English to a screen reader. Its two scripts are then the same text on every page, and a Content-Security-Policy allows them by their hash. The deployment guide gives a strict policy, checked in a browser against this site.

The policy

For a 0.4 project

Nothing to change: a 0.4 configuration builds as it is, and a site already in two languages is untouched — the question only shapes a new project. Migrate from latest to beta lists what changes on its own, and what is worth turning on.