pageproof 0.1.0 → 0.1.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.2 - 2026-05-16
4
+
5
+ - Updated the bundled Codex/Claude `SKILL.md`.
6
+
7
+ ## 0.1.1 - 2026-05-16
8
+
9
+ - Renamed the package and other pieces to `pageproof`.
10
+
11
+ ## 0.1.0 - 2026-05-16
12
+
13
+ - Initial npm release.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # mdpreview
1
+ # Pageproof
2
2
 
3
- `mdpreview` opens a live, paginated browser preview for a Markdown document. It
3
+ `pageproof` opens a live, paginated browser preview for a Markdown document. It
4
4
  uses Pandoc for Markdown and citeproc citations, then uses Paged.js
5
5
  in the browser to render paginated output including footnotes. (Pandoc must be installed.)
6
6
 
@@ -13,13 +13,13 @@ Markdown can include scripts, so only preview Markdown you trust!
13
13
  ## Installation and usage
14
14
 
15
15
  ```sh
16
- npm install -g mdpreview
16
+ npm install -g pageproof
17
17
 
18
18
  # install as a skill for codex
19
- mkdir -p ~/.agents/skills/mdpreview && mdpreview --show-skill > ~/.agents/skills/mdpreview/SKILL.md
19
+ mkdir -p ~/.agents/skills/pageproof && pageproof --show-skill > ~/.agents/skills/pageproof/SKILL.md
20
20
 
21
21
  # install as a skill for Claude Code
22
- mkdir -p ~/.claude/skills/mdpreview && mdpreview --show-skill > ~/.claude/skills/mdpreview/SKILL.md
22
+ mkdir -p ~/.claude/skills/pageproof && pageproof --show-skill > ~/.claude/skills/pageproof/SKILL.md
23
23
  ```
24
24
 
25
25
  ## Usage
@@ -32,13 +32,13 @@ and it should know what to do.
32
32
  To use it at the command line,
33
33
 
34
34
  ```sh
35
- mdpreview FILE.md
36
- mdpreview --style=doublespaced --citations=chicago FILE.md
37
- mdpreview --styles
35
+ pageproof FILE.md
36
+ pageproof --style=doublespaced --citations=chicago FILE.md
37
+ pageproof --styles
38
38
  ```
39
39
 
40
40
  It will start up a browser viewing the compiled document. When the user
41
- closes the browser, `mdpreview` will automatically shut down.
41
+ closes the browser, `pageproof` will automatically shut down.
42
42
 
43
43
 
44
44
  ## Document and citation styles
@@ -49,7 +49,7 @@ The default base-style list consists of just one, `msword`.
49
49
  Other bundled mix-in styles include `doublespaced`, and `numbered` for numbered section headings.
50
50
  Thus, for example, to get double-spaced output, use
51
51
  ```sh
52
- mdpreview --style=doublespaced FILE.md
52
+ pageproof --style=doublespaced FILE.md
53
53
  ```
54
54
 
55
55
  **Citations** are handled by Pandoc. Your markdown document should include front-matter such as
@@ -61,18 +61,18 @@ bibliography: myrefs.bib
61
61
  ```
62
62
  and then you can cite using `[@citeref]`. To choose the citation format, use e.g.
63
63
  ```sh
64
- mdpreview --citations=chicago FILE.md
64
+ pageproof --citations=chicago FILE.md
65
65
  ```
66
- Available citation formats are listed by `mdpreview --styles`.
66
+ Available citation formats are listed by `pageproof --styles`.
67
67
 
68
68
  ## Configuration
69
69
 
70
- Add CSS stylesheets or CSL bibliography styles to `~/.mdpreview/`. They will be included
71
- in the `mdpreview --styles` list, and you can select them with `--style` or `--citations`.
70
+ Add CSS stylesheets or CSL bibliography styles to `~/.pageproof/`. They will be included
71
+ in the `pageproof --styles` list, and you can select them with `--style` or `--citations`.
72
72
  In the case of name conflict, user-provided files take precedence over the built-in styles.
73
73
 
74
74
  To specify the default document styles and citation style, specify the configuration
75
- in `~/.mdpreview/config.yaml`:
75
+ in `~/.pageproof/config.yaml`:
76
76
  ```yaml
77
77
  styles: [msword]
78
78
  citations: european-journal-of-international-law
package/assets/SKILL.md CHANGED
@@ -1,58 +1,63 @@
1
1
  ---
2
- name: mdpreview
2
+ name: pageproof
3
3
  description: Use to open a live browser preview of a Markdown document, especially when the user wants to see it paginated and with citations and footnotes. Do not use for one-off Markdown-to-PDF conversion.
4
4
  ---
5
5
 
6
- # mdpreview
6
+ # Pageproof
7
7
 
8
- `mdpreview` is a CLI tool that opens a live, paginated browser preview of a Markdown
8
+ `pageproof` is a CLI tool that opens a live, paginated browser preview of a Markdown
9
9
  file. It handles footnotes and citations, and reloads automatically when the source file changes.
10
10
 
11
11
  ## Opening a preview
12
12
 
13
- Use this skill when the user asks to preview a Markdown document.
14
- Always invoke in detached mode so the shell returns once the preview is up:
13
+ When the user asks to preview a Markdown document, invoke this comment:
15
14
  ```sh
16
- mdpreview --detached "FILE.md"
15
+ pageproof --detached "FILE.md"
17
16
  ```
18
- It will launch a browser tab and start an HTTP server
19
- on a random localhost port. It will also print a status URL.
17
+ It will start an HTTP server on a random localhost port, and open a browser tab.
18
+ On WSL, it will use `cmd.exe` to open the browser.
20
19
 
21
- If the user asks about errors in the document, fetch this printed status URL:
20
+ The agent's sandbox must permit spawning the browser opener and making localhost HTTP
21
+ requests. If either action is blocked, request approval/escalation with a short
22
+ justification rather than treating the denial as a bug with the document or the pageproof command.
23
+
24
+ The `pageproof` command will also print a status URL and a PID. Do not report these
25
+ to the user, unless the user explicitly asks for them. They are intended for you to
26
+ monitor the status of the document and the previewer so that you can help the user,
27
+ they are not useful for the user directly.
28
+
29
+ The server should automatically shut down when the user closes the browser tab.
30
+
31
+
32
+ ## Inspecting the status of the previewer
33
+
34
+ If the user asks about errors in the document, fetch the printed status URL:
22
35
  ```sh
23
36
  curl http://localhost:<port>/status.json
24
37
  ```
25
38
  The status includes Pandoc warnings and errors for the current document.
26
39
 
40
+ To check on the health of the server, either monitor the server's PID (which is printed on startup), or fetch `/status.json` which reports whether a browser is currently attached.
41
+
42
+ To terminate the server, kill the PID that was printed at startup:
43
+ ```sh
44
+ kill <PID>
45
+ ```
46
+
47
+
27
48
  ## Styles
28
49
 
29
- To choose a different document style, for example double-spaced output:
50
+ If the user asks for a different document style, for example double-spaced output,
51
+ terminate the server then restart it with the requested style, e.g.
30
52
  ```sh
31
- mdpreview --detached --style=doublespaced FILE.md
53
+ pageproof --detached --style=doublespaced FILE.md
32
54
  ```
33
55
 
34
- Use this to list available styles:
56
+ To see a list available styles:
35
57
  ```sh
36
- mdpreview --styles
58
+ pageproof --styles
37
59
  ```
38
60
 
39
- There are
40
- also options to specify the citation format. Use the CLI's `--citations` option
61
+ This command also shows options to specify the citation format. Use the CLI's `--citations` option
41
62
  when the user asks for a specific citation style.
42
63
 
43
- ## Permissions and lifecycle
44
-
45
- `mdpreview` launches a browser tab and binds an HTTP server on a random localhost
46
- port. Under WSL the browser is opened via `cmd.exe`.
47
-
48
- The sandbox must permit spawning the browser opener and making localhost HTTP
49
- requests. If either action is blocked, request approval/escalation with a short
50
- justification rather than treating the denial as a document or CLI bug.
51
-
52
- The server should automatically shut down when the user closes the browser tab.
53
- To check on the health of the server, either monitor the server's PID
54
- (which is printed on startup), or fetch `/status.json` which reports whether
55
- a browser is currently attached. To terminate the server, kill the printed PID:
56
- ```sh
57
- kill <PID>
58
- ```
package/assets/_paged.css CHANGED
@@ -1,4 +1,4 @@
1
- /* mdpreview-style: Page geometry, Paged.js support, footnote mechanics, and preview chrome. */
1
+ /* pageproof-style: Page geometry, Paged.js support, footnote mechanics, and preview chrome. */
2
2
  :root {
3
3
  color: black;
4
4
  background: #F0F0F0;
@@ -1,4 +1,4 @@
1
- /* mdpreview-style: Double-spaced text override for manuscript drafts. */
1
+ /* pageproof-style: Double-spaced text override for manuscript drafts. */
2
2
  html {
3
3
  line-height: 2;
4
4
  }
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="mdpreview">
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Pageproof">
2
2
  <rect width="64" height="64" rx="10" fill="#3f3f3f"/>
3
3
  <rect x="18" y="-10" width="28" height="34" rx="2" fill="#f7f7f2"/>
4
4
  <rect x="18" y="40" width="28" height="34" rx="2" fill="#f7f7f2"/>
package/assets/latex.css CHANGED
@@ -1,4 +1,4 @@
1
- /* mdpreview-style: LaTeX-like document theme with Computer Modern-style typography. */
1
+ /* pageproof-style: LaTeX-like document theme with Computer Modern-style typography. */
2
2
  :root {
3
3
  color: black;
4
4
  font-family: "MJX-TEX-N", "MJXTEX", "CMU Serif", "Computer Modern Serif",
package/assets/msword.css CHANGED
@@ -1,4 +1,4 @@
1
- /* mdpreview-style: Default Times/Calibri document theme for academic prose. */
1
+ /* pageproof-style: Default Times/Calibri document theme for academic prose. */
2
2
  :root {
3
3
  color: black;
4
4
  font-family: "Times New Roman", Times, serif;
@@ -1,4 +1,4 @@
1
- /* mdpreview-style: Heading-numbering mix-in using legal-style nested counters. */
1
+ /* pageproof-style: Heading-numbering mix-in using legal-style nested counters. */
2
2
 
3
3
  /* Unnumbered headings (Pandoc `# heading {-}`) are treated transparently to
4
4
  the counter cascade (matching LaTeX section-star): they do not advance the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pageproof",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Live Pandoc Markdown preview with paginated browser output.",
5
5
  "type": "module",
6
6
  "author": "Damon Wischik <djw1005@cam.ac.uk>",
@@ -21,6 +21,7 @@
21
21
  "bin/",
22
22
  "src/",
23
23
  "README.md",
24
+ "CHANGELOG.md",
24
25
  "LICENSE",
25
26
  "THIRD_PARTY_NOTICES.md"
26
27
  ],
package/src/assets.js CHANGED
@@ -30,7 +30,7 @@ export async function resolveAsset(kind, name, options = {}) {
30
30
  const filename = `${name}.${selector.ext}`;
31
31
  const homeDir = options.homeDir ?? os.homedir();
32
32
  const candidates = [
33
- path.join(homeDir, '.mdpreview', filename),
33
+ path.join(homeDir, '.pageproof', filename),
34
34
  path.join(packageRoot, 'assets', filename)
35
35
  ];
36
36
 
@@ -70,12 +70,12 @@ export async function resolveAssets(selections, options = {}) {
70
70
  }
71
71
 
72
72
  async function loadConfig(homeDir) {
73
- const configPath = path.join(homeDir, '.mdpreview', 'config.yaml');
73
+ const configPath = path.join(homeDir, '.pageproof', 'config.yaml');
74
74
  if (!(await pathExists(configPath))) return { path: configPath, data: {} };
75
75
  try {
76
76
  return { path: configPath, data: parseYaml(await fs.readFile(configPath, 'utf8')) ?? {} };
77
77
  } catch (error) {
78
- throw new Error(`Invalid mdpreview config ${configPath}: ${error?.message || String(error)}`);
78
+ throw new Error(`Invalid pageproof config ${configPath}: ${error?.message || String(error)}`);
79
79
  }
80
80
  }
81
81
 
@@ -83,7 +83,7 @@ function configBaseStyles(config) {
83
83
  const base = config.data?.styles;
84
84
  if (base === undefined) return [...defaultBaseStyles];
85
85
  if (!Array.isArray(base) || base.some((item) => typeof item !== 'string')) {
86
- throw new Error(`Invalid mdpreview config ${config.path}: styles must be a list of style names.`);
86
+ throw new Error(`Invalid pageproof config ${config.path}: styles must be a list of style names.`);
87
87
  }
88
88
  return base;
89
89
  }
@@ -92,7 +92,7 @@ function configCitationStyle(config) {
92
92
  const value = config.data?.citations;
93
93
  if (value === undefined) return null;
94
94
  if (typeof value !== 'string') {
95
- throw new Error(`Invalid mdpreview config ${config.path}: citations must be a string.`);
95
+ throw new Error(`Invalid pageproof config ${config.path}: citations must be a string.`);
96
96
  }
97
97
  return value;
98
98
  }
@@ -119,7 +119,7 @@ async function listAvailableAssets(kind, homeDir) {
119
119
  if (!selector) throw new Error(`Unknown asset type: ${kind}`);
120
120
  const discovered = new Map();
121
121
  const roots = [
122
- { source: 'user', dir: path.join(homeDir, '.mdpreview') },
122
+ { source: 'user', dir: path.join(homeDir, '.pageproof') },
123
123
  { source: 'bundled', dir: path.join(packageRoot, 'assets') }
124
124
  ];
125
125
 
@@ -164,7 +164,7 @@ async function describeAsset(kind, assetPath) {
164
164
  }
165
165
 
166
166
  function cssDescription(text) {
167
- const match = text.match(/^\s*\/\*\s*mdpreview-style:\s*([^*]+?)\s*\*\//i);
167
+ const match = text.match(/^\s*\/\*\s*pageproof-style:\s*([^*]+?)\s*\*\//i);
168
168
  return match ? collapseWhitespace(match[1]) : '';
169
169
  }
170
170
 
package/src/cli.js CHANGED
@@ -142,8 +142,8 @@ export async function stylesText(options = {}) {
142
142
  }
143
143
 
144
144
  function configHelpText() {
145
- return `Additional styles (NAME.css) and citation styles (NAME.csl) can be placed in ~/.mdpreview/.
146
- Defaults can be overridden in ~/.mdpreview/config.yaml, e.g.
145
+ return `Additional styles (NAME.css) and citation styles (NAME.csl) can be placed in ~/.pageproof/.
146
+ Defaults can be overridden in ~/.pageproof/config.yaml, e.g.
147
147
  styles: [msword]
148
148
  citations: european-journal-of-international-law`;
149
149
  }
package/bin/mdpreview.js DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { runCli } from '../src/cli.js';
4
-
5
- runCli(process.argv.slice(2)).catch((error) => {
6
- console.error(error?.message || String(error));
7
- process.exitCode = 1;
8
- });