Skip to content

Commit a60198d

Browse files
committed
refactor!: rename to astroprint due to npm naming issue
1 parent 1712348 commit a60198d

23 files changed

Lines changed: 219 additions & 219 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
node_modules
22
.astro
33
dist
4-
.aprint*
4+
.astroprint*
55
site-dist
66
public
77
.DS_Store

AGENTS.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Project Overview
44

5-
`aprint` is an Astro integration for Markdown-first documents with normal web preview, Paged.js browser preview, and PDF export.
5+
`astroprint` is an Astro integration for Markdown-first documents with normal web preview, Paged.js browser preview, and PDF export.
66

7-
Calling `aprint()` with no options should only install the Markdown processing pipeline: directives, the built-in `:logolink` transform, BibTeX conversion, and HTML comment stripping. Do not inject collection routes unless the user explicitly configures `routes`, and do not set a default PDF target unless the user configures top-level `pdf`. `routes` is a list, not a keyed object; PDF generation is configured separately through top-level `pdf`.
7+
Calling `astroprint()` with no options should only install the Markdown processing pipeline: directives, the built-in `:logolink` transform, BibTeX conversion, and HTML comment stripping. Do not inject collection routes unless the user explicitly configures `routes`, and do not set a default PDF target unless the user configures top-level `pdf`. `routes` is a list, not a keyed object; PDF generation is configured separately through top-level `pdf`.
88

9-
Route injection should be decided before calling `injectRoute`, not inside generated route `getStaticPaths()`. Generated routes should assume they are meant to render once injected. In `astro dev`, always inject configured routes. In PDF render builds, `APRINT_RENDER_HTML=true` must force route injection regardless of route flags so `aprint pdf` can reach configured routes. In normal `astro build`, each route's `injectDuringBuild` flag controls injection; it defaults to `true`, and `false` keeps that route out of the production build graph to avoid preview-only client chunks such as `PrintPreview.astro` unless the user opted in.
9+
Route injection should be decided before calling `injectRoute`, not inside generated route `getStaticPaths()`. Generated routes should assume they are meant to render once injected. In `astro dev`, always inject configured routes. In PDF render builds, `ASTROPRINT_RENDER_HTML=true` must force route injection regardless of route flags so `astroprint pdf` can reach configured routes. In normal `astro build`, each route's `injectDuringBuild` flag controls injection; it defaults to `true`, and `false` keeps that route out of the production build graph to avoid preview-only client chunks such as `PrintPreview.astro` unless the user opted in.
1010

11-
When a route config omits `route`, the default route is `/aprint/{collection}`. PDF output paths are resolved as normal filesystem paths: `outputDir` is the base directory and `output` is resolved inside it, with absolute `output` paths used as-is. When the CLI omits `--port`, the temporary server should bind to an OS-assigned free port.
11+
When a route config omits `route`, the default route is `/astroprint/{collection}`. PDF output paths are resolved as normal filesystem paths: `outputDir` is the base directory and `output` is resolved inside it, with absolute `output` paths used as-is. When the CLI omits `--port`, the temporary server should bind to an OS-assigned free port.
1212

1313
The package code lives in `src/`. Built-in Astro surfaces live directly under top-level source folders:
1414

@@ -25,7 +25,7 @@ The playground content lives under `playground/` and is useful for local validat
2525

2626
## Markdown Directives
2727

28-
`remark-directive` is installed by the integration. `remarkAprintDirectives` should keep directives generic: known list aliases map to semantic tags (`ul`, `ol`, `li`, `entry`), unknown text directives default to `span`, and unknown leaf/container directives default to `div`. All directives get a default `aprint-{name}` class unless the caller overrides that directive with `directives`.
28+
`remark-directive` is installed by the integration. `remarkAstroPrintDirectives` should keep directives generic: known list aliases map to semantic tags (`ul`, `ol`, `li`, `entry`), unknown text directives default to `span`, and unknown leaf/container directives default to `div`. All directives get a default `astroprint-{name}` class unless the caller overrides that directive with `directives`.
2929

3030
Directive attributes should pass through to rendered HTML properties. Prefer standard directive attribute syntax for classes:
3131

@@ -60,10 +60,10 @@ HTML comment removal is handled separately by `src/lib/remark-strip-html-comment
6060
For validating injected document routes in a static build, run:
6161

6262
```bash
63-
APRINT_RENDER_HTML=true pnpm exec astro build --outDir .aprint-check
63+
ASTROPRINT_RENDER_HTML=true pnpm exec astro build --outDir .astroprint-check
6464
```
6565

66-
Remove generated validation output afterward. Do not edit `.astro/`, `.aprint/`, `.aprint-check/`, `dist/`, `site-dist/`, or `public/` as source files.
66+
Remove generated validation output afterward. Do not edit `.astro/`, `.astroprint/`, `.astroprint-check/`, `dist/`, `site-dist/`, or `public/` as source files.
6767

6868
`pnpm vendor:pagedjs` downloads `pagedjs@0.4.3/dist/paged.esm.js` from unpkg and minifies it to `src/vendor/pagedjs-0.4.3.esm.min.js` with esbuild. Keep the version in the filename, the fetch URL, and `PrintPreview.astro`'s URL import in sync when upgrading Paged.js. The minified bundle keeps upstream legal comments; do not replace it with `paged.min.js` because that file is not the ESM named-export bundle loaded by `PrintPreview.astro`.
6969

@@ -75,19 +75,19 @@ It wraps slotted document content, feeds selected page styles to Paged.js, and r
7575

7676
`PrintPreview.astro` imports the vendored Paged.js ESM bundle from `src/vendor/` as a URL asset, then dynamically imports that URL at runtime. This keeps the component usable without requiring consuming projects to install `pagedjs` or configure Vite `optimizeDeps`, while avoiding a large preview-runtime chunk warning during production builds.
7777

78-
After Paged.js finishes paginating, `PrintPreview.astro` inserts a browser-print `@page` style with concrete page size and margin values resolved from the source document. Paged.js injects `@page { margin: 0 }` rules for its screen preview, so the aprint print rule must be inserted after pagination. Keep this in sync with the Paged.js preview stylesheet so browser printing from preview routes matches normal document printing.
78+
After Paged.js finishes paginating, `PrintPreview.astro` inserts a browser-print `@page` style with concrete page size and margin values resolved from the source document. Paged.js injects `@page { margin: 0 }` rules for its screen preview, so the astroprint print rule must be inserted after pagination. Keep this in sync with the Paged.js preview stylesheet so browser printing from preview routes matches normal document printing.
7979

8080
The component script initializes all `.print-preview-source` instances because Astro may emit the component script once per page even when the component appears multiple times.
8181

8282
Callers must define page variables on the document or `:root`:
8383

84-
- `--aprint-page-width`
85-
- `--aprint-page-height`
86-
- `--aprint-page-margin-top`
87-
- `--aprint-page-margin-x`
88-
- `--aprint-page-margin-bottom`
84+
- `--astroprint-page-width`
85+
- `--astroprint-page-height`
86+
- `--astroprint-page-margin-top`
87+
- `--astroprint-page-margin-x`
88+
- `--astroprint-page-margin-bottom`
8989

90-
`--aprint-print-preview-top-offset` is optional.
90+
`--astroprint-print-preview-top-offset` is optional.
9191

9292
Paged.js receives all linked stylesheets plus inline styles matched by `styleSelector`, after PrintPreview's internal `data-print-preview-ignore` style is removed. Caller-owned preview chrome styles should be kept in a top-level `<style is:inline data-preview-ignore>` block and excluded with `styleSelector="style:not([data-preview-ignore])"`.
9393

@@ -107,17 +107,17 @@ Keep document styles and preview chrome styles separate:
107107

108108
- `base.css` should define baseline variables and neutral document root behavior that every theme can inherit or override.
109109
- `academic-cv.css` should override baseline variables and style document content for the built-in academic theme.
110-
- `Document.astro` should own only the theme-neutral document root and may import `base.css`; do not import theme CSS from it. Aprint-owned root elements should use the `aprint-scope` class so `base.css` can apply scoped reset styles without touching host-page chrome.
110+
- `Document.astro` should own only the theme-neutral document root and may import `base.css`; do not import theme CSS from it. AstroPrint-owned root elements should use the `astroprint-scope` class so `base.css` can apply scoped reset styles without touching host-page chrome.
111111
- `BaseLayout.astro` should own only the HTML shell, optional `pageTitle`, and global page/body baseline.
112112
- `PreviewLayout.astro` should own only the theme-neutral navigation, print button, preview status, preview branching, and caller-owned preview chrome styles.
113113
- `AcademicLayout.astro` should own the built-in academic title markup and frontmatter/entry mapping. It defaults to `BaseLayout.astro` for standalone Markdown and uses `PreviewLayout.astro` when generated routes pass `preview={true}`.
114-
- `PrintPreview.astro` should remain document-agnostic and should not depend on `.aprint-document` beyond what callers pass through `documentSelector`. Layouts that render their own document root without `Document.astro` should import `base.css` or define equivalent page variables and `@page` rules.
114+
- `PrintPreview.astro` should remain document-agnostic and should not depend on `.astroprint-document` beyond what callers pass through `documentSelector`. Layouts that render their own document root without `Document.astro` should import `base.css` or define equivalent page variables and `@page` rules.
115115

116116
Standalone Markdown pages can opt into the built-in academic document surface with:
117117

118118
```md
119119
---
120-
layout: aprint/layouts/AcademicLayout.astro
120+
layout: astroprint/layouts/AcademicLayout.astro
121121
---
122122
```
123123

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
99

1010
### Added
1111

12-
- Initial release of `aprint`.
12+
- Initial release of `astroprint`.
1313
- Adds Astro integration support for Markdown directives, `:logolink`, BibTeX conversion, and HTML comment stripping.
14-
- Adds optional collection-backed document routes, Paged.js preview routes, and PDF export through the `aprint pdf` CLI.
14+
- Adds optional collection-backed document routes, Paged.js preview routes, and PDF export through the `astroprint pdf` CLI.
1515
- Includes built-in document, preview, and academic CV layouts plus baseline and academic CV styles.

0 commit comments

Comments
 (0)