@zeropress/build-pages 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Build ZeroPress static output for modern hosting platforms.
7
7
 
8
- `@zeropress/build-pages` turns a directory of Markdown files and public assets into a static ZeroPress site. It discovers Markdown pages, prepares the site data, stages public files, and runs [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build).
8
+ `@zeropress/build-pages` turns Markdown files and public assets into a static ZeroPress site. It discovers Markdown pages, prepares the site data, stages public files, and runs [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build).
9
9
 
10
10
  The generated output is plain static files that can be deployed to GitHub Pages, Cloudflare Pages, Netlify, Vercel, or any static hosting provider.
11
11
 
@@ -13,7 +13,9 @@ The generated output is plain static files that can be deployed to GitHub Pages,
13
13
 
14
14
  ```txt
15
15
  source directory
16
- Markdown pages + .zeropress/config.json + public files
16
+ Markdown pages + .zeropress/config.json
17
+ public directory
18
+ public files (defaults to source)
17
19
  |
18
20
  v
19
21
  @zeropress/build-pages
@@ -32,7 +34,7 @@ static output directory
32
34
  flowchart TD
33
35
  source["Source directory"] --> markdown["Markdown pages (*.md)"]
34
36
  source --> config[".zeropress/config.json"]
35
- source --> publicFiles["Public files<br/>images, CSS, JS, PDF, JSON, Markdown"]
37
+ publicRoot["Public directory<br/>defaults to source"] --> publicFiles["Public files<br/>images, CSS, JS, PDF, JSON, Markdown"]
36
38
 
37
39
  markdown --> buildPages["@zeropress/build-pages"]
38
40
  config --> buildPages
@@ -127,17 +129,30 @@ Custom input example:
127
129
  - name: Build ZeroPress Pages
128
130
  uses: zeropress-app/zeropress-build-pages@v0
129
131
  with:
130
- source: ./documents
132
+ source: ./docs
133
+ public-dir: ./public
131
134
  destination: ./_site
132
135
  theme-path: ./theme-docs
133
- config: ./documents/.zeropress/config.json
136
+ config: ./docs/.zeropress/config.json
134
137
  site-url: https://example.com/docs
135
138
  copy-markdown-source: false
136
139
  ```
137
140
 
141
+ Separate public asset directory example:
142
+
143
+ ```yaml
144
+ - name: Build ZeroPress Pages
145
+ uses: zeropress-app/zeropress-build-pages@v0
146
+ with:
147
+ source: ./docs
148
+ public-dir: ./public
149
+ destination: ./_site
150
+ ```
151
+
138
152
  In the action inputs:
139
153
 
140
- - `source` is the directory that contains your Markdown pages, public files, and optional `.zeropress/config.json`. The default is `./docs`.
154
+ - `source` is the directory that contains your Markdown pages and optional `.zeropress/config.json`. The default is `./docs`.
155
+ - `public-dir` is the directory copied as public passthrough files. The default is `source`. If you set it explicitly, the directory must exist.
141
156
  - `destination` is the directory where the generated static site is written. The default is `./_site`.
142
157
  - `theme` is the bundled theme name. The default is `docs`.
143
158
  - `theme-path` is a custom local ZeroPress theme directory. It takes precedence over `theme`.
@@ -145,7 +160,7 @@ In the action inputs:
145
160
  - `site-url` overrides the canonical site URL from config.
146
161
  - `skip-untitled-markdown` skips Markdown files without a page title instead of failing. The default is `false`.
147
162
  - `skip-link-check` skips internal link checking after build. The default is `false`; broken internal links are reported as warnings and do not fail the build.
148
- - `copy-markdown-source` copies original Markdown files to the generated output and enables `View this page as Markdown` links in the bundled docs theme. The default is `true`.
163
+ - `copy-markdown-source` copies original Markdown files to the generated output and enables `View this page as Markdown` links in the bundled docs theme. The default is `true`; when set to `false`, public `.md` passthrough files are also skipped.
149
164
 
150
165
  For GitHub Pages, the generated `destination` directory can be passed to `actions/upload-pages-artifact`. For Cloudflare Pages, Netlify, Vercel, or another static host, pass the same `destination` directory to that provider's deploy step.
151
166
 
@@ -158,16 +173,37 @@ npx @zeropress/create-theme --name my-docs-theme --template docs
158
173
  ```yaml
159
174
  with:
160
175
  source: ./docs
176
+ public-dir: ./public
161
177
  destination: ./_site
162
178
  theme-path: ./my-docs-theme/theme
163
179
  ```
164
180
 
181
+ ### Vercel
182
+
183
+ Use the `Other` framework preset and set the generated output directory as Vercel's Output Directory.
184
+
185
+ Project settings:
186
+
187
+ | Setting | Value |
188
+ | --- | --- |
189
+ | Framework Preset | `Other` |
190
+ | Build Command | `npx --yes @zeropress/build-pages --source ./docs --destination ./_site` |
191
+ | Output Directory | `_site` |
192
+
193
+ If your public assets live outside the source directory, include `--public-dir`:
194
+
195
+ ```bash
196
+ npx --yes @zeropress/build-pages --source ./docs --public-dir ./public --destination ./_site
197
+ ```
198
+
199
+ If your project uses a `package.json` script, set the Vercel Build Command to `npm run build` and keep the Output Directory as `_site`.
200
+
165
201
  ### npx
166
202
 
167
203
  Use `npx` when you want to run Build Pages without adding it to your project dependencies.
168
204
 
169
205
  ```bash
170
- npx @zeropress/build-pages --source ./documents --destination ./_site
206
+ npx @zeropress/build-pages --source ./docs --destination ./_site
171
207
  ```
172
208
 
173
209
  ### package.json script
@@ -181,7 +217,7 @@ npm install --save-dev @zeropress/build-pages
181
217
  ```json
182
218
  {
183
219
  "scripts": {
184
- "build": "zeropress-build-pages --source ./documents --destination ./_site"
220
+ "build": "zeropress-build-pages --source ./docs --destination ./_site"
185
221
  }
186
222
  }
187
223
  ```
@@ -196,19 +232,20 @@ The CLI requires explicit input and output paths. The GitHub Action keeps safe d
196
232
 
197
233
  | Option | Default | Purpose |
198
234
  | --- | --- | --- |
199
- | `--source <dir>` | required | Dedicated source directory containing Markdown and public files |
235
+ | `--source <dir>` | required | Dedicated source directory containing Markdown and optional config |
236
+ | `--public-dir <dir>` | source | Public passthrough directory. Explicit paths must exist. |
200
237
  | `--destination <dir>` | required | Output directory |
201
- | `--theme docs` | `docs` | Bundled docs theme |
238
+ | `--theme <name>` | `docs` | Bundled theme name |
202
239
  | `--theme-path <dir>` | none | Custom ZeroPress theme directory |
203
240
  | `--config <path>` | `<source>/.zeropress/config.json` | Build Pages config |
204
241
  | `--site-url <url>` | config `site.url` | Canonical URL override |
205
242
  | `--skip-untitled-markdown` | `false` | Skip Markdown without a page title |
206
243
  | `--skip-link-check` | `false` | Skip warning-only internal link checking |
207
- | `--no-copy-markdown-source` | `false` | Do not copy original Markdown files to output |
244
+ | `--no-copy-markdown-source` | `false` | Do not copy source Markdown or public `.md` files to output |
208
245
 
209
246
  ## Source Tree
210
247
 
211
- The source directory is the folder that Build Pages reads. It is both the Markdown source root and the public passthrough root. GitHub Action usage defaults to `./docs`; CLI usage requires `--source`.
248
+ The source directory is the folder that Build Pages reads for Markdown pages and optional `.zeropress/config.json`. By default, the source directory is also the public passthrough root. Use `public-dir` when you want to keep Markdown source and public assets separate.
212
249
 
213
250
  Use a dedicated content directory such as `docs/` or `documents/`. Repository root source (`--source ./`) is not supported.
214
251
 
@@ -217,22 +254,27 @@ my-site/
217
254
  docs/ # source
218
255
  index.md
219
256
  guide.md
220
- assets/
221
- logo.png
222
257
  .zeropress/
223
258
  config.json
259
+ public/ # public-dir, optional
260
+ assets/
261
+ logo.png
262
+ favicon.svg
263
+ robots.txt
224
264
  _site/ # destination, generated
225
265
  ```
226
266
 
227
- Build Pages stages the source tree before calling [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build). Generated ZeroPress output wins over staged public files.
267
+ Build Pages stages the public directory before calling [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build). Generated ZeroPress output wins over staged public files.
268
+
269
+ Root-level public files named `favicon.ico`, `favicon.svg`, `favicon.png`, and `apple-touch-icon.png` are copied to the destination and auto-injected into generated HTML `<head>` output.
228
270
 
229
- Root-level source favicon files named `favicon.ico`, `favicon.svg`, `favicon.png`, and `apple-touch-icon.png` are copied to the destination and auto-injected into generated HTML `<head>` output.
271
+ A root-level public `sitemap.xsl` is copied to the destination. When ZeroPress generates `sitemap.xml`, it auto-discovers that file and adds an XML stylesheet processing instruction for `/sitemap.xsl`.
230
272
 
231
- A root-level source `sitemap.xsl` is copied to the destination. When ZeroPress generates `sitemap.xml`, it auto-discovers that file and adds an XML stylesheet processing instruction for `/sitemap.xsl`.
273
+ The source directory must not overlap the destination directory, the selected theme directory, or the internal `.zeropress/` working directory. An explicit public directory must be an existing dedicated directory and must not be a file, symlink, repository root, destination directory, selected theme directory, or internal `.zeropress/` working directory.
232
274
 
233
- The source directory must not overlap the destination directory, the selected theme directory, or the internal `.zeropress/` working directory.
275
+ If `public-dir` is inside `source`, Build Pages excludes that public subtree from Markdown page discovery.
234
276
 
235
- Ignored while staging and Markdown discovery:
277
+ Ignored while copying public passthrough files and discovering Markdown pages:
236
278
 
237
279
  - hidden paths such as `.git`, `.env`, and `.zeropress`
238
280
  - `node_modules`
@@ -259,7 +301,7 @@ Additional Markdown discovery ignores:
259
301
  - Other Markdown files map to extensionless routes, such as `cli/tool.md` -> `/cli/tool`.
260
302
  - Markdown links to other discovered `.md` files are rewritten to generated public URLs.
261
303
  - Original Markdown files remain available as public passthrough files by default.
262
- - Use `--no-copy-markdown-source` or Action input `copy-markdown-source: false` to keep source Markdown out of the generated output. This also hides bundled theme `View this page as Markdown` links.
304
+ - Use `--no-copy-markdown-source` or Action input `copy-markdown-source: false` to keep source Markdown and public `.md` passthrough files out of the generated output. This also hides bundled theme `View this page as Markdown` links.
263
305
 
264
306
  Optional YAML front matter is supported at the top of Markdown files:
265
307
 
@@ -319,6 +361,52 @@ Use `meta` for small scalar flags and metadata. Use `data` when a theme should i
319
361
  {{/for}}
320
362
  ```
321
363
 
364
+ ## Markdown Rendering
365
+
366
+ Build Pages renders Markdown through ZeroPress build-core before writing HTML.
367
+ This includes common Markdown extensions such as tables, strikethrough, task
368
+ lists, GitHub-style alerts, heading IDs, and fenced code blocks.
369
+
370
+ Fenced code blocks are highlighted at build time with `highlight.js`.
371
+
372
+ ````md
373
+ ```js
374
+ console.log("hello");
375
+ ```
376
+ ````
377
+
378
+ When a fenced code block has a language info string and `highlight.js`
379
+ recognizes it, ZeroPress uses that language. If the language is missing or not
380
+ recognized, ZeroPress falls back to automatic detection. The generated markup
381
+ keeps the `language-*` class and adds `hljs-*` token classes for highlighted
382
+ spans:
383
+
384
+ ```html
385
+ <pre><code class="language-js">...</code></pre>
386
+ ```
387
+
388
+ Themes only need CSS for the generated code markup. A client-side
389
+ `highlight.js` script is not required for Markdown rendered during the build.
390
+
391
+ ZeroPress build-core currently uses `highlight.js@11.11.1` and the built-in
392
+ languages returned by `hljs.listLanguages()`. In this release, that is 192
393
+ canonical language names, plus recognized aliases such as `js`, `ts`, `jsx`,
394
+ `sh`, and `zsh`. A language listed in the Highlight.js documentation with a
395
+ third-party package is not bundled by ZeroPress unless it is also present in
396
+ `hljs.listLanguages()`.
397
+
398
+ See the upstream
399
+ [`highlight.js@11.11.1` supported languages table](https://github.com/highlightjs/highlight.js/blob/11.11.1/SUPPORTED_LANGUAGES.md)
400
+ for language names, aliases, and third-party package notes. Common built-in
401
+ examples include `bash`, `shell`, `js`, `javascript`, `ts`, `typescript`,
402
+ `json`, `yaml`, `html`, `xml`, `css`, `scss`, `python`, `ruby`, `php`, `java`,
403
+ `go`, `rust`, `c`, `cpp`, `csharp`, `sql`, `graphql`, `dockerfile`, `nginx`,
404
+ `markdown`, and `diff`.
405
+
406
+ Mermaid is intentionally different: `mermaid` fences remain readable code
407
+ blocks such as `pre code.language-mermaid`. Diagram rendering is optional
408
+ progressive enhancement owned by the theme or site.
409
+
322
410
  ## Config
323
411
 
324
412
  Build Pages reads `<source>/.zeropress/config.json` when present. Missing config falls back to defaults.
@@ -327,17 +415,27 @@ See the public config reference at [zeropress.dev/build-pages-config](https://ze
327
415
 
328
416
  ```json
329
417
  {
330
- "$schema": "https://zeropress.dev/schemas/zeropress-build-pages.config.v0.1.schema.json",
418
+ "$schema": "https://schemas.zeropress.dev/build-pages-config/v0.1/schema.json",
331
419
  "version": "0.1",
332
420
  "site": {
333
421
  "title": "My Docs",
334
422
  "description": "Project documentation",
335
423
  "url": "https://example.github.io/project",
424
+ "logo": {
425
+ "src": "/logo.svg",
426
+ "alt": "My Docs"
427
+ },
428
+ "locale": "en-US",
336
429
  "expose_generator": true,
430
+ "search": true,
337
431
  "indexing": true,
338
432
  "footer": {
339
433
  "copyright_text": "Copyright 2026 Example Corp.",
340
434
  "attribution": true
435
+ },
436
+ "meta": {
437
+ "issue": "Spring 2026",
438
+ "show_sponsor_banner": false
341
439
  }
342
440
  },
343
441
  "front_page": {
@@ -381,13 +479,35 @@ Menu item `meta` is optional scalar display metadata copied into generated previ
381
479
 
382
480
  The bundled docs theme shows `Published with ZeroPress.` by default. Set `site.footer.attribution` to `false` to hide it.
383
481
 
482
+ `site.logo` is optional theme-facing brand data. Use a root-relative public path for public logo files, or an absolute URL for media-hosted logos. Build Pages emits `media_base_url: ""`, so root-relative logo paths remain same-host public paths.
483
+
484
+ `site.locale` is optional language metadata copied into generated preview-data. It affects theme-facing `site.locale`, the common `language` render context value, generated HTML language metadata, and feed language. Missing `site.locale` defaults to `en-US`.
485
+
486
+ `site.meta` is an optional scalar extension map copied into generated preview-data. Use it for site-level theme conventions such as labels, feature flags, or issue names. Values must be strings, finite numbers, booleans, or null. Use first-class fields such as `site.logo.src` instead of ad hoc keys like `site.meta.logo_url`.
487
+
384
488
  `site.expose_generator` controls the HTML generator meta tag. Missing or `true` emits `<meta name="generator" content="ZeroPress">`; set it to `false` for white-label sites.
385
489
 
386
- `site.indexing` controls only the generated fallback `robots.txt`. Missing or `true` allows indexing; `false` writes `User-agent: *` / `Disallow: /`. If the source directory contains `robots.txt`, that file is copied as-is and takes priority over `site.indexing`. ZeroPress does not append a `Sitemap` directive to a source-provided `robots.txt`; add `Sitemap: https://example.com/sitemap.xml` manually when needed.
490
+ `site.indexing` controls only the generated fallback `robots.txt`. Missing or `true` allows indexing; `false` writes `User-agent: *` / `Disallow: /`. If the public directory contains `robots.txt`, that file is copied as-is and takes priority over `site.indexing`. ZeroPress does not append a `Sitemap` directive to a public `robots.txt`; add `Sitemap: https://example.com/sitemap.xml` manually when needed.
387
491
 
388
492
  Schemas:
389
493
 
390
- - [ZeroPress Build Pages Config v0.1](https://zeropress.dev/schemas/zeropress-build-pages.config.v0.1.schema.json)
494
+ - [ZeroPress Build Pages Config v0.1](https://schemas.zeropress.dev/build-pages-config/v0.1/schema.json)
495
+
496
+ ## Search
497
+
498
+ The bundled docs theme supports ZeroPress native search. `site.search` controls whether search artifacts and bundled search UI are enabled.
499
+
500
+ Missing or `true` enables native search for the bundled docs theme. Build Pages writes `/_zeropress/search.json`, `/_zeropress/search.js`, and `/_zeropress/search_pagefind.js`.
501
+
502
+ Set `site.search` to `false` to omit those search artifacts and hide the bundled search form.
503
+
504
+ The bundled docs theme marks post/page body content with `data-pagefind-body`. If you run Pagefind after the ZeroPress build, keep the theme UI pointed at `/_zeropress/search.js` and replace the native adapter:
505
+
506
+ ```bash
507
+ npx pagefind@latest --site ./_site --output-subdir _zeropress/pagefind
508
+ cp ./_site/_zeropress/search_pagefind.js ./_site/_zeropress/search.js
509
+ rm ./_site/_zeropress/search.json
510
+ ```
391
511
 
392
512
  ## Workspace Internal `.zeropress/` Files
393
513
 
@@ -405,13 +525,13 @@ Build Pages reads optional site config from `<source>/.zeropress/config.json`. S
405
525
 
406
526
  `preview-data.json` is an internal generated build input for the ZeroPress renderer. Most users do not need to edit or understand this file.
407
527
 
408
- `build-report.json` records discovered Markdown counts, skipped Markdown files, front page resolution, source Markdown copy policy, and custom HTML slots.
528
+ `build-report.json` records source/public roots, discovered Markdown counts, skipped Markdown files, front page resolution, source Markdown copy policy, and custom HTML slots.
409
529
 
410
530
  `public-assets/` is a temporary staged public root used before the final ZeroPress render.
411
531
 
412
532
  ## Destination Output
413
533
 
414
- The `destination` directory contains the deployable static site. It includes generated ZeroPress HTML, copied public files, and original Markdown files unless Markdown source copy is disabled or files are excluded by the public passthrough rules. A source `robots.txt` is copied as a site-owned policy file; otherwise ZeroPress writes a fallback `robots.txt` with a sitemap directive when `site.url` is available. Root-level source favicon files are copied and represented as generated HTML head links. A root-level source `sitemap.xsl` is copied and linked from generated `sitemap.xml`.
534
+ The `destination` directory contains the deployable static site. It includes generated ZeroPress HTML, copied public files, and original Markdown files unless Markdown source copy is disabled or files are excluded by the public passthrough rules. A public `robots.txt` is copied as a site-owned policy file; otherwise ZeroPress writes a fallback `robots.txt` with a sitemap directive when `site.url` is available. Root-level public favicon files are copied and represented as generated HTML head links. A root-level public `sitemap.xsl` is copied and linked from generated `sitemap.xml`.
415
535
 
416
536
  ## Demo
417
537
 
package/action.yml CHANGED
@@ -9,6 +9,9 @@ inputs:
9
9
  description: Dedicated source directory containing Markdown files and optional .zeropress/config.json. Repository root source is not supported.
10
10
  required: false
11
11
  default: ./docs
12
+ public-dir:
13
+ description: Public passthrough directory for site-owned assets. Defaults to source.
14
+ required: false
12
15
  destination:
13
16
  description: Output directory for the generated static site.
14
17
  required: false