Install
Lesson 1 of 3.
Before you start
You need Node.jsThe JavaScript runtime DocPensieve runs on — version 22 or later. and a terminal. Nothing else: the theme ships with the tool.
Your turn
npx docpensieve init my-course
The command asks a few questions, then writes the project.
| It asks | Why it matters |
|---|---|
| A name | Shown in the header and in the tab |
| A public address | Fills the sitemap and the share previews; can be left for later |
| A first version | Names the folder your pages live in — docs/v1.0 |
| A theme | tailwind to write utilities in pages, custom for classes of yours |
| The documentation | Installs this tool's own documentation inside your site, or not |
Without a real terminal — a script, a pipeline, a piped command — init asks nothing and takes
the defaults. It says so before starting, unless you passed --yes, which is the way to mean it
on purpose.
What it writes
my-course
- docpensieve.config.mjs — every setting of the site
docs
v1.0
- index.md — the home page
- 01-guide — a first section, with an example page
- 99-docpensieve — this tool's own documentation, to delete when done
- .gitignore — keeps dist/ and node_modules/ out of the repository
A configuration file, a documentation folder and a first page — ready to build.
No framework to add, no build tool to configure, no server to run in production.
Open the configuration
It is the file you will come back to in every module of this course. Every setting is written in it, most of them commented out — it is a menu as much as a configuration:
/** @type {import('@docpensieve/core').DocPensieveConfig} */
export default {
// Name shown in the header, in the page titles and in the structured data.
projectName: 'My documentation',
// Public address of the site. It feeds the canonical links and the
// structured data, and its path gives the deployment prefix.
// siteUrl: 'https://example.com/my-project',
versions: [
{
slug: 'v1.0', // URL segment, and name of the version's branch
name: '1.0', // label in the version switcher
folder: 'docs/v1.0',
current: true,
},
],
};
The comment above the file is not decoration: it is what gives your editor the name and the shape of every field, so a typo shows up while you type rather than at the next build.
The extension is what tells Node to read the file as a module. A .js file works only if a
package.json nearby says so — and the one npm init writes says the opposite. The tool
accepts both and refuses to guess when it finds two.
Check yourself
Which file holds the settings of the project?
docpensieve.config.mjs, at the root of the project.
You ran init in a pipeline and it created a site you did not choose. Why?
There was no terminal to answer the questions, so it took the defaults. Pass
the options on the command line — or --yes — when you want that on purpose.
This lesson uses Skill, Tooltip, Tree, Admonition, Columns and Card — the installation guide covers the options one by one.
DocPensieve