@@ -15,9 +15,86 @@ The `web` generator accepts the following configuration options:
1515| ` useAbsoluteURLs ` | ` boolean ` | ` false ` | When ` true ` , all internal links use absolute URLs based on ` baseURL ` |
1616| ` editURL ` | ` string ` | ` '${GITHUB_EDIT_URL}/doc/api{path}.md' ` | URL template for "edit this page" links |
1717| ` pageURL ` | ` string ` | ` '{baseURL}/latest-{version}/api{path}.html' ` | URL template for documentation page links |
18+ | ` head ` | ` object ` | See below | Configurable ` <meta> ` , ` <link> ` , and raw markup for the document head |
19+ | ` lightningcss ` | ` object ` | ` {} ` | Options spread into LightningCSS while bundling CSS (see below) |
1820| ` imports ` | ` object ` | See below | Object mapping ` #theme/ ` aliases to component paths for customization |
1921| ` virtualImports ` | ` object ` | ` {} ` | Additional virtual module mappings merged into the build |
2022
23+ #### ` head `
24+
25+ The ` head ` object controls the project-specific markup injected into the
26+ document ` <head> ` (rendered into the template's ` ${head} ` placeholder). It has
27+ three keys:
28+
29+ | Key | Type | Description |
30+ | ------- | ------- | ------------------------------------------------------------------------------------------- |
31+ | ` meta ` | ` array ` | ` <meta> ` tags. Each entry is an attribute bag, e.g. ` { name: 'description', content: '…' } ` |
32+ | ` links ` | ` array ` | ` <link> ` tags. Each entry is an attribute bag, e.g. ` { rel: 'icon', href: '…' } ` |
33+ | ` html ` | ` array ` | Raw HTML strings appended verbatim — an escape hatch for anything not expressible above |
34+
35+ Each attribute bag is rendered as a tag: a boolean ` true ` becomes a valueless
36+ attribute (e.g. ` crossorigin ` ), and ` false ` /` null ` /` undefined ` attributes are
37+ omitted. Using arrays of attribute bags (rather than ` name → value ` maps) means
38+ you can emit repeated tags (e.g. two ` preconnect ` links) and pick the right
39+ attribute (` name ` vs ` property ` ) per tag.
40+
41+ The defaults are Node.js-branded — override ` head ` entirely to brand the output
42+ for any project:
43+
44+ ``` js
45+ // doc-kit.config.mjs
46+ export default {
47+ web: {
48+ head: {
49+ meta: [
50+ { name: ' description' , content: ' My project documentation' },
51+ { property: ' og:image' , content: ' https://example.com/og.png' },
52+ ],
53+ links: [
54+ { rel: ' icon' , href: ' https://example.com/favicon.ico' },
55+ { rel: ' stylesheet' , href: ' https://example.com/fonts.css' },
56+ ],
57+ html: [' <meta name="theme-color" content="#000" />' ],
58+ },
59+ },
60+ };
61+ ```
62+
63+ > Structural and theme-bound tags are emitted by the template itself rather than
64+ > via ` head ` : ` og:title ` (mirrors the per-page title), ` og:type ` , and the font
65+ > preconnects/stylesheet the bundled UI components rely on.
66+
67+ #### Custom LightningCSS options
68+
69+ The ` lightningcss ` object is spread directly into [ LightningCSS] [ lightningcss ]
70+ while CSS is bundled, so any of its options — ` visitor ` (custom plugins),
71+ ` customAtRules ` , ` targets ` , ` drafts ` , and so on — are supported. The generator
72+ manages ` filename ` , ` code ` , ` cssModules ` , and ` resolver ` , so those are ignored.
73+
74+ ``` js
75+ // doc-kit.config.mjs
76+ export default {
77+ web: {
78+ lightningcss: {
79+ customAtRules: {
80+ mixin: { prelude: ' <custom-ident>' , body: ' style-block' },
81+ },
82+ visitor: {
83+ Color (color ) {
84+ // e.g. transform every color through a design-token map
85+ return color;
86+ },
87+ },
88+ },
89+ },
90+ };
91+ ```
92+
93+ To apply more than one visitor, compose them with LightningCSS's
94+ ` composeVisitors ` helper and pass the result as ` visitor ` .
95+
96+ [ lightningcss ] : https://lightningcss.dev/transforms.html
97+
2198#### Default ` imports `
2299
23100| Alias | Default | Description |
@@ -118,6 +195,7 @@ The HTML template file (set via `templatePath`) uses JavaScript template literal
118195| ` root ` | ` string ` | Relative or absolute path to the site root |
119196| ` metadata ` | ` object ` | Full page metadata (frontmatter, path, heading, etc.) |
120197| ` config ` | ` object ` | The resolved web generator configuration |
198+ | ` head ` | ` string ` | Pre-rendered ` <meta> ` /` <link> ` /raw markup from the ` head ` config |
121199
122200Since the template supports arbitrary JS expressions, you can use conditionals and method calls:
123201
0 commit comments