@neo4j-antora/pdf-generator 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-antora/pdf-generator",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Generates a PDF export from an Antora docset, styled to match the real Neo4j docs site, via @antora/assembler + @antora/pdf-extension and asciidoctor-web-pdf",
5
5
  "main": "extension.js",
6
6
  "files": [
@@ -248,7 +248,12 @@ tr { break-inside: avoid; }
248
248
  padding: 6pt 10pt;
249
249
  background: var(--brand-bg-strong);
250
250
  }
251
- .admonitionblock .title {
251
+ /* Style only the admonition's own title (a direct child of its content cell), not every
252
+ `.title` inside it. A table in an admonition has its caption as `caption.title`; with
253
+ these rules applied to it, the caption was made `display: block` (so it was laid out
254
+ after the header row instead of above it) and shown in capitals and the admonition
255
+ colour. */
256
+ .admonitionblock td.content > .title {
252
257
  font-weight: 700;
253
258
  text-transform: uppercase;
254
259
  font-size: 8.5pt;
@@ -262,20 +267,20 @@ tr { break-inside: avoid; }
262
267
  border-left-color: var(--brand-warning);
263
268
  background: var(--brand-warning-bg);
264
269
  }
265
- .admonitionblock.warning .title,
266
- .admonitionblock.caution .title { color: var(--brand-warning); }
270
+ .admonitionblock.warning td.content > .title,
271
+ .admonitionblock.caution td.content > .title { color: var(--brand-warning); }
267
272
  .admonitionblock.important td.content {
268
273
  border-left-color: var(--brand-danger);
269
274
  background: var(--brand-danger-bg);
270
275
  }
271
- .admonitionblock.important .title { color: var(--brand-danger); }
276
+ .admonitionblock.important td.content > .title { color: var(--brand-danger); }
272
277
  .admonitionblock.note td.content,
273
278
  .admonitionblock.tip td.content {
274
279
  border-left-color: var(--brand-primary);
275
280
  background: var(--brand-primary-weak);
276
281
  }
277
- .admonitionblock.note .title,
278
- .admonitionblock.tip .title { color: var(--brand-primary-strong); }
282
+ .admonitionblock.note td.content > .title,
283
+ .admonitionblock.tip td.content > .title { color: var(--brand-primary-strong); }
279
284
 
280
285
  /* lists */
281
286
  .ulist, .olist, .dlist { margin: 0.5em 0; }
@@ -107,6 +107,24 @@ const extraArgs = [
107
107
  '--extension', REMOTE_INCLUDE_ADAPTER,
108
108
  '--extension', MACROS_ADAPTER,
109
109
  ]
110
+ // Reading from stdin (this is piped the merged .adoc, not a real file - see
111
+ // below), asciidoctor-web-pdf invents a fictive input path rooted at
112
+ // `--base-dir`/`-B` if given, else its own cwd (lib/cli.js's
113
+ // _convertFromStdin), and writes its temporary intermediate HTML file next
114
+ // to THAT path (lib/converter.js's getTemporaryHtmlFile), not next to the
115
+ // real docdir the assembler passes via `-a docdir=...`. Without `-B`, that
116
+ // temp HTML ends up sitting in whatever directory this script itself was
117
+ // invoked from (the docset's own root, since that's antora's cwd) - one or
118
+ // more levels away from `-a docdir`/`-a imagesoutdir`. Every image target,
119
+ // resolved correctly as relative to the real docdir (e.g. `../_images/
120
+ // foo.png`), then resolves relative to the WRONG directory when the
121
+ // browser loads that temp HTML via file://, so every image in the PDF is
122
+ // silently broken. Passing the same docdir here as `-B` puts the temp HTML
123
+ // file where the image paths actually expect it to be.
124
+ const docdirIdx = args.findIndex((arg) => arg.startsWith('docdir='))
125
+ if (docdirIdx > 0 && args[docdirIdx - 1] === '-a') {
126
+ extraArgs.push('-B', args[docdirIdx].slice('docdir='.length))
127
+ }
110
128
  const finalArgs =
111
129
  stdinMarkerIdx === -1
112
130
  ? [...args, ...extraArgs]