Skip to content
DocPensieve
Documentation menu

Install

Module progress33%

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 asksWhy it matters
A nameShown in the header and in the tab
A public addressFills the sitemap and the share previews; can be left for later
A first versionNames the folder your pages live in — docs/v1.0
A themetailwind to write utilities in pages, custom for classes of yours
The documentationInstalls this tool's own documentation inside your site, or not
No questions?

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
What you get

A configuration file, a documentation folder and a first page — ready to build.

What you do not need

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.

Why .mjs

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.