@bendyline/squisq-formats 2.6.18 → 2.6.20
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/NOTICE.md +1 -1
- package/README.md +1 -1
- package/THIRD_PARTY_LICENSES.txt +2 -2
- package/dist/{chunk-JY3T4KOP.js → chunk-3NKXJF4C.js} +1 -1
- package/dist/{chunk-VJQZMIXU.js → chunk-4GAVHDHU.js} +13 -4
- package/dist/{chunk-YFSFEPBB.js → chunk-5ACTORJI.js} +1 -1
- package/dist/{chunk-76BFHBZD.js → chunk-BHWIHYUJ.js} +1 -1
- package/dist/{chunk-53CTG4YR.js → chunk-JXPZEP7D.js} +1 -1
- package/dist/chunk-LBXBRFBZ.js +94 -0
- package/dist/{chunk-NVMYRBOJ.js → chunk-TX2HE34S.js} +1 -1
- package/dist/docx/index.js +2 -2
- package/dist/epub/index.js +2 -2
- package/dist/html/index.js +1 -1
- package/dist/index.js +8 -8
- package/dist/outside-in/index.js +2 -2
- package/dist/pdf/index.d.ts +2 -1
- package/dist/pdf/index.js +2 -2
- package/dist/pptx/index.js +2 -2
- package/dist/registry/index.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-USU6HTKB.js +0 -94
- /package/dist/{chunk-SZDCCL6O.js → chunk-YEV3P7PN.js} +0 -0
package/NOTICE.md
CHANGED
|
@@ -11,7 +11,7 @@ Third-party components remain under their respective license terms.
|
|
|
11
11
|
| @pdf-lib/fontkit | 1.1.1 | MIT | https://github.com/Hopding/fontkit |
|
|
12
12
|
| @pdf-lib/upng | 1.0.1 | MIT | https://github.com/Hopding/upng |
|
|
13
13
|
| @xmldom/xmldom | 0.9.12 | MIT | https://github.com/xmldom/xmldom |
|
|
14
|
-
| jszip | 3.10.
|
|
14
|
+
| jszip | 3.10.2 | MIT OR GPL-3.0-or-later | https://github.com/Stuk/jszip |
|
|
15
15
|
| pdf-lib | 1.17.1 | MIT | https://pdf-lib.js.org |
|
|
16
16
|
| pdfjs-dist | 4.10.38 | Apache-2.0 | https://mozilla.github.io/pdf.js |
|
|
17
17
|
| hyparquet _(peer)_ | ^1.29.1 | MIT | https://github.com/hyparam/hyparquet |
|
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ const imported = await pdfToMarkdownDoc(pdfBuffer);
|
|
|
87
87
|
const container = await pdfToContainer(pdfBuffer);
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
**Fidelity:** export uses pdf-lib's standard 14 fonts (`themeId` affects colors only). Pass `images` (keyed by the markdown URL, as for DOCX) to draw PNG and JPEG images that stand alone in a paragraph; other images print as an `[Image: alt]` note. PDF has no semantic structure, so import is heuristic and best-effort: headings are detected by font size, and tables / code blocks / blockquotes / links via the `detectTables` / `detectCodeBlocks` / `detectBlockquotes` / `detectLinks` options (all default true). `pdfToMarkdownDoc` is text-only; `pdfToContainer` also extracts embedded XObject and inline raster images in browsers and Node, placed **by page** — each image is inserted after the last content block from its page (image-only pages fall back to the nearest preceding page with content, else the document end). Placement is page-level only; masks, vector artwork, and images that PDF.js cannot expose as decoded pixels are not emitted.
|
|
90
|
+
**Fidelity:** export uses pdf-lib's standard 14 fonts (`themeId` affects colors only). Pages stay white for printing. Theme text, heading, and link colors are retained when they meet 4.5:1 contrast against both white paper and the shaded table header; otherwise the exporter uses its default dark ink for that role. This also applies to inherited and custom themes. Pass `images` (keyed by the markdown URL, as for DOCX) to draw PNG and JPEG images that stand alone in a paragraph; other images print as an `[Image: alt]` note. PDF has no semantic structure, so import is heuristic and best-effort: headings are detected by font size, and tables / code blocks / blockquotes / links via the `detectTables` / `detectCodeBlocks` / `detectBlockquotes` / `detectLinks` options (all default true). `pdfToMarkdownDoc` is text-only; `pdfToContainer` also extracts embedded XObject and inline raster images in browsers and Node, placed **by page** — each image is inserted after the last content block from its page (image-only pages fall back to the nearest preceding page with content, else the document end). Placement is page-level only; masks, vector artwork, and images that PDF.js cannot expose as decoded pixels are not emitted.
|
|
91
91
|
|
|
92
92
|
### Diagrams as pictures
|
|
93
93
|
|
package/THIRD_PARTY_LICENSES.txt
CHANGED
|
@@ -5,10 +5,10 @@ and notice files are reproduced verbatim. When an npm tarball omits its
|
|
|
5
5
|
repository license, the pinned upstream copy is vendored and identified below.
|
|
6
6
|
|
|
7
7
|
COMPONENTS
|
|
8
|
-
- @fortawesome/fontawesome-free@7.
|
|
8
|
+
- @fortawesome/fontawesome-free@7.3.1 ((CC-BY-4.0 AND OFL-1.1 AND MIT)); files: LICENSE.txt
|
|
9
9
|
|
|
10
10
|
==============================================================================
|
|
11
|
-
@fortawesome/fontawesome-free@7.
|
|
11
|
+
@fortawesome/fontawesome-free@7.3.1 - LICENSE.txt
|
|
12
12
|
==============================================================================
|
|
13
13
|
Fonticons, Inc. (https://fontawesome.com)
|
|
14
14
|
|
|
@@ -342,7 +342,7 @@ ${body}
|
|
|
342
342
|
function escapeStyleText(css) {
|
|
343
343
|
return css.replace(/</g, "\\3c ");
|
|
344
344
|
}
|
|
345
|
-
var FONT_AWESOME_LINK = `<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.
|
|
345
|
+
var FONT_AWESOME_LINK = `<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.3.1/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer">
|
|
346
346
|
`;
|
|
347
347
|
function docUsesIcons(doc) {
|
|
348
348
|
function visit(node) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
collectInlineIconFamilies,
|
|
12
12
|
fontAwesomeFaces,
|
|
13
13
|
fontAwesomeGlyph
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LBXBRFBZ.js";
|
|
15
15
|
import {
|
|
16
16
|
fitWithin,
|
|
17
17
|
readImageDimensions
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
// src/pdf/export.ts
|
|
21
21
|
import { PDFDocument, StandardFonts, rgb, PDFString } from "pdf-lib";
|
|
22
22
|
import fontkit from "@pdf-lib/fontkit";
|
|
23
|
+
import { contrastRatio } from "@bendyline/squisq/schemas";
|
|
23
24
|
import { docToMarkdown, resolveThemeForDoc } from "@bendyline/squisq/doc";
|
|
24
25
|
import { readFrontmatterThemeId, sanitizeUrl } from "@bendyline/squisq/markdown";
|
|
25
26
|
|
|
@@ -477,9 +478,9 @@ async function createExportContext(pdfDoc, options, doc) {
|
|
|
477
478
|
if (themeId) {
|
|
478
479
|
const theme = resolveThemeForDoc(doc, themeId, options.themeRegistry);
|
|
479
480
|
if (theme.colors) {
|
|
480
|
-
colorText =
|
|
481
|
-
colorHeading =
|
|
482
|
-
colorLink =
|
|
481
|
+
colorText = paperInk(theme.colors.text, COLOR_TEXT);
|
|
482
|
+
colorHeading = paperInk(theme.colors.primary, COLOR_HEADING);
|
|
483
|
+
colorLink = paperInk(theme.colors.highlight || theme.colors.secondary, COLOR_LINK);
|
|
483
484
|
}
|
|
484
485
|
}
|
|
485
486
|
return {
|
|
@@ -1172,6 +1173,14 @@ function renderFallbackBlock(node, ctx, extraIndent) {
|
|
|
1172
1173
|
ctx.y -= lineH + PARAGRAPH_SPACING;
|
|
1173
1174
|
}
|
|
1174
1175
|
}
|
|
1176
|
+
function paperInk(hex, fallback) {
|
|
1177
|
+
const color = hexToRgb(hex);
|
|
1178
|
+
if (!color) return fallback;
|
|
1179
|
+
const tableHeader = "#" + [COLOR_TABLE_HEADER_BG.r, COLOR_TABLE_HEADER_BG.g, COLOR_TABLE_HEADER_BG.b].map(
|
|
1180
|
+
(channel) => Math.round(channel * 255).toString(16).padStart(2, "0")
|
|
1181
|
+
).join("");
|
|
1182
|
+
return contrastRatio(hex, "#ffffff") >= 4.5 && contrastRatio(hex, tableHeader) >= 4.5 ? color : fallback;
|
|
1183
|
+
}
|
|
1175
1184
|
function hexToRgb(hex) {
|
|
1176
1185
|
const h = hex.startsWith("#") ? hex.slice(1) : hex;
|
|
1177
1186
|
if (h.length !== 6) return void 0;
|