1Introduction

The Kit covers a finite set of presentations and document types. Sooner or later a project meets a need that is not among them: a missing layout, a particular kind of block, a rule specific to its field.

Two routes exist. Modifying the Kit's files meets the need at once, and forces a choice at the first update between your adaptation and the new version. Adding your own files alongside costs a little more work up front and lets both coexist.

This document describes the second route: where your files belong, how to name them, how a generator combines them with those of the Kit, and what breaks when the Kit evolves.

2What belongs to the Kit and what belongs to you

The boundary is a prefix. Every file whose name starts with “Kit -” or “kit_” comes from the Kit, as do the gen-kit-site.js and gen-glossary-reference.js generators, its package.json and package-lock.json and its icons: all live in its kit/ folder, beside the project's, replaced wholesale at the next update — Common Structure §3. Your files carry your project's prefix: its documents, its Registry, its data modules, its executable artifacts and its stylesheets — Common Structure §2.

–Kit files, replaced wholesale: the stylesheets and their Reference, the executable artifacts kit_*.py and kit_*.js, Kit - Registry.js, and the Kit's own documents. The replacement procedure is described in the Update Guide.

–Project files, touched only on your confirmation: your Registry, your Prompt, your documents, your data modules, your executable artifacts — Common Structure §12 — and the stylesheets this document teaches you to write. A Kit update touches them only at the points of Update Guide §4.4.

Note:A Kit file modified in place loses its modification at the next update, without warning: replacement is an overwrite. That is why extension goes through addition.

3Replacing the colours

The colours of the Kit's General and HTML stylesheets are defaults. [Prefix] - Colors (TS).js carries those of your project and takes precedence over them; the Glossary and YAML stylesheets follow its docx table, which the generator passes to them — Common Structure §6.6. It declares only the keys it changes; the rest keep their default value.

The file is driven by the requires.colors flag of the project Registry: ask the AI to set it to true, otherwise the generator will not load it. It exports colorEntries, an object with two tables: docx for the documents, html for the web pages. Separating them lets you set the contrast on printed paper independently of the screen. The key names and their defaults are tabulated in General Reference and HTML Reference, and the file's contract in Common Structure §6.5.

The Kit checks neither contrast nor harmony: an unreadable colour produces a valid document that is tiresome to read. A value that is not a colour, on the other hand, stops generation, naming the offending key.

// [Préfixe] - Colors (TS).js
const colorEntries = {
  docx: { HEADING_COLOR: '8B0000' },
  html: { HEADING_COLOR: '#8B0000', CODE_BG: '#FAFAFA' },
};
module.exports = { colorEntries };

The generator loads this file and applies it. The stylesheet imports neither the Registry nor this file: the generator bridges the two, as it does for the language and the glossary.

// setColors ne remplace que les cles declarees.
if (couleurs) style.setColors(couleurs.docx);

4Writing your own stylesheet

Your own stylesheet exports functions that produce blocks, exactly like those of the Kit. It complements the General stylesheet rather than replacing it: your generator imports both and calls one or the other depending on the block.

4.1Naming and file set

The name follows the convention of the Kit's stylesheets, with your project's prefix: “[Prefix] - Stylesheet - [Subject] - Code (TS).js”.

The Reference .docx carries the same prefix, the same subject and the same timestamp as its .js. The two are delivered together — the file set rule, Prompt §6, applies to your stylesheets as to the Kit's.

The Reference records what the code alone does not say: the formatting values, the return contracts, the mandatory sequences. It is regenerated at each change to the .js, never rebuilt from the code alone.

4.2What your stylesheet imports

The Kit's geometry constants — indents, table widths, fonts, colours — belong to the General stylesheet and are read from it. Colours are read at call time, style.BODY_TEXT_COLOR or getColors(): destructured at require, they would keep the Kit default that setColors replaces afterwards. Copying them into your own file creates a divergence that shows only at the first change of geometry. The docx module is taken from the sheet, style.docx — General Reference §1.3.

const style = require('../kit/Kit - Stylesheet - General - Code (TS).js');
 
// La geometrie vient de General, jamais d'une copie locale.
const { INDENT_L1, INDENT_L2, TABLE_WIDTH_L1, FONT } = style;
 
// Les couleurs se lisent a l'appel : setColors les change apres le require.
const couleurTexte = () => style.BODY_TEXT_COLOR;
Note:The Kit's YAML stylesheet is the exception and imports nothing: it must remain usable on its own. Its geometry values are therefore copied and documented as such. For any other stylesheet, importing is the default choice.

4.3What your stylesheet exports

Each function returns either a Paragraph or an array of elements, like the Kit's functions. The return contract is documented in your Reference: what the function returns, what must precede it, what must follow it.

Two of the Kit's rules apply to your functions. Naming is explicit, with no abbreviation and no acronym to decode — Prompt §12. And every displayed string goes through a localisation table, even if your project speaks only one language today — Prompt §4.1.

5Registering your stylesheet

Your stylesheet's version is declared in your project's Registry, stylesheets section — Common Structure §5.1. The section exists only if the project writes a stylesheet.

// [Préfixe] - Registry.js — rubrique stylesheets
stylesheets: {
  '[feuille]': { version: '1.00', ts: 'AAAA-MM-JJ - HHhMM' },
},

Your generators read the active version there rather than carrying it hard-coded. The Kit's Registry keeps the versions of its own stylesheets; the project's keeps those of yours, with its documents and timestamps.

6Writing a generator that combines the Kit and your stylesheet

A generator imports the Kit's stylesheet and yours, then calls each according to the block to produce. The order of calls determines the order of the document, as in any generator.

const style = require('../kit/Kit - Stylesheet - General - Code (TS).js');
const feuille = require('./[Préfixe] - Stylesheet - [Feuille] - Code (TS).js');
const registry = require('./[Préfixe] - Registry.js');
 
style.setLanguage(registry.project.docLanguage);
feuille.setLanguage(registry.project.docLanguage);
 
const corps = [
  style.h1('1', '[Titre]'),
  style.paragraph('[Texte]'),
  feuille.schema(image, '[Légende]'), // votre fonction a vous
  style.releaseParagraph(),
];

The section level is held by the General stylesheet: h1, h2 and h3 set it, resetLevel puts it back to 1, and the other functions read it. A stylesheet of your own that needs the current level reads it through style.currentLevel() and never writes it: one more function writing it would reopen the matching error this arrangement closes.

7What validation covers

The Kit's checking tools apply to your documents without adaptation, as long as your stylesheet takes its geometry from General, as §4.2 asks: check 11 of the validator admits only its indents. They read the produced file, not the code that produced it.

–kit_validate_docx.js: checks the structure of the produced .docx — levels, sequences, version fingerprint. It expects the fingerprint of the General stylesheet, which your documents carry since it builds them.

–kit_check_setters.py: the one exception to the sentence above: it reads the generator, not the document. It checks that the setters required by the Registry flags are called up front — an omitted setter silently disables the matching rendering. It therefore applies to the generator this document teaches you to write.

–kit_check_markup.py: compares the markup between a source binary and the regenerated document. Useful as soon as you take up an existing document.

–kit_check_ossature.py: compares the skeleton of two language variants.

–kit_extract_map.py and kit_check_fidelite.py: extraction recognises the Kit's blocks. A block produced by your stylesheet is unknown to it and will come back degraded. The fidelity check will tell you — that is its purpose. The answer is to report the need to the Kit: extraction is a Kit file, under the reserved prefix — Kit Prompt §7. Since the round trip is a link of every delivery — Quality Control §3.13 —, the document is not delivered until the Kit’s extraction recognises that block.

Note:Extraction is part of the Kit and follows its updates: a new block type is reported to the Kit — Common Structure §13 describes the route.

8What breaks when the Kit evolves

The Kit offers no compatibility, forward or backward. An evolution may rename a function, change a signature or remove a helper. Your stylesheet, which calls the Kit's, bears the consequences.

–A function name changes: your calls fail loudly at the first run. That is the most comfortable case — the error is immediate and localised.

–A geometry value changes: your blocks shift without anything failing, if you copied the value instead of importing it. That is the reason for the rule in §4.2.

–A sequence contract changes: a successor that has become mandatory produces a malformed document that no check reliably flags — Quality Control §2.5. Read the stylesheet's Reference after each update.

The session in which an update is absorbed — described in the Update Guide — is when these gaps are dealt with. Your stylesheets are reread there alongside your generators.

9Creating templates outside the Kit

A project whose subject demands it — a recipe, a field sheet, a page format foreign to documentation — may create templates of its own, outside the Kit's forms. The right is declared in the Registry by allowNonKitTemplates, false by default. It is a written permission, which no check enforces: without it, a project keeps to the Kit's forms.

The right bears on forms, never on rules. The project keeps the same reflexes: source file first, Registry as the authority, fresh timestamp, version number raised per Naming Convention §6, document generator rewritten from scratch, file sets in agreement, validation chain before any delivery, no loss of content, no formatting from memory, decisions written into the documents at the same time as they are applied to the code. Anything that would change a common rule goes back to the Kit — Common Structure §13 — rather than being fixed on the spot.

What the Kit no longer guarantees: it no longer answers for the rendering produced by a template outside the Kit, nor for its survival when a stylesheet evolves. It still requires the reflexes, the validation chain and the identity of the subsite. A document made on a template outside the Kit leaves the fidelity round trip, which cannot rebuild it; the rest of the chain applies — Quality Control §3.10.

10Publishing a page flow outside the documents

A project may publish pages that descend from no document: a section fed by a data module, one page per entry, under a folder other than html/. The Kit renders the body and the shell of those pages, through the same helpers and the same renderDocument as the documentation pages.

The boundary holds in one sentence: the Kit renders, the project keeps its data, its loop and its naming. No HTML shell is composed inside the project. A text that has not passed through the stylesheet is neither escaped, nor corrected, nor coloured, and the flaw shows only when the page is read.

–Linking from one page to another. The construction <<label|target>> sets the link. The target is a path internal to the site, relative to its root; the html/ folder is closed to it, a documentation page being reached through the document reference.

–Checking the targets at the end of the pass. The stylesheet judges the form and stops on a malformed target. It can say nothing of existence: when a paragraph is rendered, the following pages are not yet written. The generator calls ciblesDeLiens() once the pass is over and compares against the site produced. controlerCiblesDeLiens, in kit_publication.js, serves that purpose; controlerLiensDuSite then checks every relative address of the site — Quality Control §3.17.

Note:The typographic correction lives in kit_typographie.js, the single source the HTML stylesheet requires. A flow that passes through no .docx gets it like everything else; the project applies nothing itself.

11When to report the need to the Kit

A local extension suits a need specific to your field. A need other projects would also meet belongs in the Kit, where it will be maintained and checked.

–The need can be stated without naming your field: it is general.

–You have written the same function twice for two different documents.

–Your stylesheet copies a geometry value from the Kit because no function exposes it.

–Extraction does not recognise your block.

The reporting route is described in Common Structure §13. A need reported and accepted becomes a function of the Kit, and your local extension gives way to it.