@bendyline/squisq-formats 2.8.9 → 2.8.11
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 +15 -13
- package/dist/{chunk-SZ3OIY6G.js → chunk-4SPMLGOG.js} +47 -93
- package/dist/{chunk-6HUQFEP3.js → chunk-D2JA3MLG.js} +6 -6
- package/dist/html/icons.d.ts +29 -0
- package/dist/{plainHtmlIcons-KBSIJ5EN.js → html/icons.js} +2 -2
- package/dist/html/index.d.ts +42 -216
- package/dist/html/index.js +5 -8
- package/dist/html/prepare.d.ts +97 -0
- package/dist/html/prepare.js +85 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -12
- package/dist/outside-in/index.js +3 -3
- package/dist/plainHtml-B6IXcSet.d.ts +148 -0
- package/dist/pptx/index.js +1 -1
- package/dist/registry/index.js +1 -1
- package/package.json +12 -2
- /package/dist/{chunk-WVDAFJFS.js → chunk-JINVU6QA.js} +0 -0
- /package/dist/{chunk-GFHUJ7L4.js → chunk-S5VXWSRR.js} +0 -0
package/README.md
CHANGED
|
@@ -337,19 +337,21 @@ Also exported: `createRegistry` / `defaultRegistry` / `defaultFormats`, `BUILTIN
|
|
|
337
337
|
|
|
338
338
|
## Subpath Exports
|
|
339
339
|
|
|
340
|
-
| Subpath
|
|
341
|
-
|
|
|
342
|
-
| `@bendyline/squisq-formats/docx`
|
|
343
|
-
| `@bendyline/squisq-formats/pdf`
|
|
344
|
-
| `@bendyline/squisq-formats/html`
|
|
345
|
-
| `@bendyline/squisq-formats/
|
|
346
|
-
| `@bendyline/squisq-formats/
|
|
347
|
-
| `@bendyline/squisq-formats/
|
|
348
|
-
| `@bendyline/squisq-formats/
|
|
349
|
-
| `@bendyline/squisq-formats/
|
|
350
|
-
| `@bendyline/squisq-formats/
|
|
351
|
-
| `@bendyline/squisq-formats/
|
|
352
|
-
| `@bendyline/squisq-formats/
|
|
340
|
+
| Subpath | Contents |
|
|
341
|
+
| ---------------------------------------- | ------------------------------------------------------------------------------- |
|
|
342
|
+
| `@bendyline/squisq-formats/docx` | DOCX import/export (+ `docxToContainer`) |
|
|
343
|
+
| `@bendyline/squisq-formats/pdf` | PDF import/export (+ `pdfToContainer`, `configurePdfWorker`) |
|
|
344
|
+
| `@bendyline/squisq-formats/html` | Player HTML export, static plain-HTML export + bundles, HTML import |
|
|
345
|
+
| `@bendyline/squisq-formats/html-prepare` | `prepareMarkdownDocForPlainHtml`: data tables and pictures for plain-HTML pages |
|
|
346
|
+
| `@bendyline/squisq-formats/html-icons` | `plainHtmlIcons`: inline icons as SVG outlines for plain-HTML pages |
|
|
347
|
+
| `@bendyline/squisq-formats/epub` | EPUB 3 e-book export (with optional Media Overlays) |
|
|
348
|
+
| `@bendyline/squisq-formats/pptx` | PPTX export + import (text/lists/tables + slide images) |
|
|
349
|
+
| `@bendyline/squisq-formats/xlsx` | XLSX import + tables-only export |
|
|
350
|
+
| `@bendyline/squisq-formats/csv` | CSV import/export (RFC 4180) |
|
|
351
|
+
| `@bendyline/squisq-formats/ooxml` | Shared OOXML infrastructure (package reader/writer, XML utilities, namespaces) |
|
|
352
|
+
| `@bendyline/squisq-formats/diagrams` | `rasterizeDiagrams` / `findDiagrams`: diagrams as pictures for document exports |
|
|
353
|
+
| `@bendyline/squisq-formats/container` | `ContentContainer` ↔ ZIP serialization |
|
|
354
|
+
| `@bendyline/squisq-formats/registry` | Format registry + programmatic `convert()` (also re-exported from the root) |
|
|
353
355
|
|
|
354
356
|
The package root re-exports the common converters; `./container`, the plain-HTML/bundle functions, `docxToContainer`, `pdfToContainer`, `PdfPageSize`, and the image utilities are subpath-only.
|
|
355
357
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
findDiagrams,
|
|
3
|
-
rasterizeDiagrams
|
|
4
|
-
} from "./chunk-4LIFEQKX.js";
|
|
5
1
|
import {
|
|
6
2
|
arrayBufferToBase64DataUrl,
|
|
7
3
|
extractFilename,
|
|
@@ -1022,80 +1018,6 @@ function escapeAttr(s) {
|
|
|
1022
1018
|
return escapeHtml2(s).replace(/"/g, """);
|
|
1023
1019
|
}
|
|
1024
1020
|
|
|
1025
|
-
// src/html/plainHtmlPrepare.ts
|
|
1026
|
-
import { isDataFilePath } from "@bendyline/squisq/doc";
|
|
1027
|
-
var PAGE_DIAGRAM_KINDS = [
|
|
1028
|
-
"mermaid",
|
|
1029
|
-
"diagram",
|
|
1030
|
-
"timeline",
|
|
1031
|
-
"container",
|
|
1032
|
-
"chart"
|
|
1033
|
-
];
|
|
1034
|
-
function needsPlainHtmlPreparation(doc, options = {}) {
|
|
1035
|
-
let icons = false;
|
|
1036
|
-
let data = false;
|
|
1037
|
-
const visit = (node) => {
|
|
1038
|
-
if (!node || typeof node !== "object" || icons && data) return;
|
|
1039
|
-
const n = node;
|
|
1040
|
-
if (n.type === "inlineIcon") icons = true;
|
|
1041
|
-
if (n.type === "heading") {
|
|
1042
|
-
const src = n.templateAnnotation?.params?.src;
|
|
1043
|
-
if (src && isDataFilePath(src)) data = true;
|
|
1044
|
-
}
|
|
1045
|
-
if (Array.isArray(n.children)) n.children.forEach(visit);
|
|
1046
|
-
};
|
|
1047
|
-
doc.children.forEach(visit);
|
|
1048
|
-
if (icons || data && options.container) return true;
|
|
1049
|
-
if (!options.renderDiagram) return false;
|
|
1050
|
-
return findDiagrams(doc).some((diagram) => PAGE_DIAGRAM_KINDS.includes(diagram.kind));
|
|
1051
|
-
}
|
|
1052
|
-
async function prepareMarkdownDocForPlainHtml(doc, options = {}) {
|
|
1053
|
-
const { renderDiagram, container, signal, onWarning } = options;
|
|
1054
|
-
let markdownDoc = doc;
|
|
1055
|
-
if (container) {
|
|
1056
|
-
const { materializeDataReferences, DATA_PREVIEW_ROWS } = await import("./materialize-ICXNO4S4.js");
|
|
1057
|
-
markdownDoc = await materializeDataReferences(markdownDoc, container, onWarning, {
|
|
1058
|
-
maxRows: options.maxDataRows ?? DATA_PREVIEW_ROWS,
|
|
1059
|
-
tableCache: options.dataTableCache
|
|
1060
|
-
});
|
|
1061
|
-
}
|
|
1062
|
-
signal?.throwIfAborted();
|
|
1063
|
-
const { plainHtmlIcons } = await import("./plainHtmlIcons-KBSIJ5EN.js");
|
|
1064
|
-
const icons = await plainHtmlIcons(markdownDoc);
|
|
1065
|
-
const images = /* @__PURE__ */ new Map();
|
|
1066
|
-
if (!renderDiagram) return { markdownDoc, images, icons };
|
|
1067
|
-
const pictured = await rasterizeDiagrams(markdownDoc, renderDiagram, {
|
|
1068
|
-
kinds: PAGE_DIAGRAM_KINDS,
|
|
1069
|
-
urlPrefix: "squisq-picture",
|
|
1070
|
-
signal,
|
|
1071
|
-
onWarning
|
|
1072
|
-
});
|
|
1073
|
-
const widths = /* @__PURE__ */ new Map();
|
|
1074
|
-
for (const [url, picture] of pictured.images) {
|
|
1075
|
-
const bytes = picture.data;
|
|
1076
|
-
const buffer = bytes.buffer.slice(
|
|
1077
|
-
bytes.byteOffset,
|
|
1078
|
-
bytes.byteOffset + bytes.byteLength
|
|
1079
|
-
);
|
|
1080
|
-
images.set(url, arrayBufferToBase64DataUrl(buffer, picture.contentType));
|
|
1081
|
-
widths.set(url, Math.round(picture.width));
|
|
1082
|
-
}
|
|
1083
|
-
return { markdownDoc: withPictureWidths(pictured.markdownDoc, widths), images, icons };
|
|
1084
|
-
}
|
|
1085
|
-
function withPictureWidths(doc, widths) {
|
|
1086
|
-
if (widths.size === 0) return doc;
|
|
1087
|
-
const visit = (node) => {
|
|
1088
|
-
if (node.type === "image") {
|
|
1089
|
-
const width = widths.get(node.url);
|
|
1090
|
-
return width === void 0 ? node : { ...node, width };
|
|
1091
|
-
}
|
|
1092
|
-
const children = node.children;
|
|
1093
|
-
if (!Array.isArray(children)) return node;
|
|
1094
|
-
return { ...node, children: children.map(visit) };
|
|
1095
|
-
};
|
|
1096
|
-
return { ...doc, children: doc.children.map(visit) };
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
1021
|
// src/html/plainHtmlBundle.ts
|
|
1100
1022
|
import JSZip from "jszip";
|
|
1101
1023
|
import { parseMarkdown, inferDocumentTitle } from "@bendyline/squisq/markdown";
|
|
@@ -1325,6 +1247,7 @@ function titleForFilename(path, mdDoc) {
|
|
|
1325
1247
|
// src/html/pageTemplate.ts
|
|
1326
1248
|
var HTML_PAGE_TEMPLATE_CONTENT_START = "<!-- squisq:content -->";
|
|
1327
1249
|
var HTML_PAGE_TEMPLATE_CONTENT_END = "<!-- /squisq:content -->";
|
|
1250
|
+
var HTML_PAGE_TEMPLATE_IMAGE_SLOT = "og-image";
|
|
1328
1251
|
var HtmlPageTemplateError = class extends Error {
|
|
1329
1252
|
constructor(issues) {
|
|
1330
1253
|
super(
|
|
@@ -1371,6 +1294,10 @@ function analyzeTemplate(html) {
|
|
|
1371
1294
|
isTemplate: tags.some(isLightSlot),
|
|
1372
1295
|
defaultSlotCount: defaultSlots.length,
|
|
1373
1296
|
namedSlots,
|
|
1297
|
+
usesImage: namedSlots.includes(HTML_PAGE_TEMPLATE_IMAGE_SLOT) || tags.some((tag) => {
|
|
1298
|
+
if (tag.kind !== "start" || tag.name !== "meta" || tag.inert) return false;
|
|
1299
|
+
return IMAGE_URL_META.has(metaKey(tag) ?? "");
|
|
1300
|
+
}),
|
|
1374
1301
|
errors: errors.sort((a, b) => a.line - b.line)
|
|
1375
1302
|
}
|
|
1376
1303
|
};
|
|
@@ -1382,19 +1309,24 @@ function applyHtmlPageTemplate(template, content, options = {}) {
|
|
|
1382
1309
|
const { tags, slots, inspection } = analyzeTemplate(template);
|
|
1383
1310
|
if (inspection.errors.length > 0) throw new HtmlPageTemplateError(inspection.errors);
|
|
1384
1311
|
const values = content.values ?? {};
|
|
1385
|
-
const
|
|
1312
|
+
const { image } = content;
|
|
1313
|
+
const valueFor = (name) => name === "title" ? content.title : name === HTML_PAGE_TEMPLATE_IMAGE_SLOT ? void 0 : values[name];
|
|
1314
|
+
const slotMarkup = (name) => {
|
|
1315
|
+
if (name === null) {
|
|
1316
|
+
return `${HTML_PAGE_TEMPLATE_CONTENT_START}
|
|
1317
|
+
${content.bodyHtml}
|
|
1318
|
+
${HTML_PAGE_TEMPLATE_CONTENT_END}`;
|
|
1319
|
+
}
|
|
1320
|
+
if (name === HTML_PAGE_TEMPLATE_IMAGE_SLOT) return image && imageElement(image);
|
|
1321
|
+
const value = valueFor(name);
|
|
1322
|
+
return value === void 0 ? void 0 : escapeHtml3(value);
|
|
1323
|
+
};
|
|
1386
1324
|
const edits = [];
|
|
1387
1325
|
const replacements = /* @__PURE__ */ new Set();
|
|
1388
1326
|
for (const slot of slots) {
|
|
1389
|
-
const
|
|
1390
|
-
if (
|
|
1391
|
-
const replacement = {
|
|
1392
|
-
start: slot.start,
|
|
1393
|
-
end: slot.end,
|
|
1394
|
-
text: slot.name === null ? `${HTML_PAGE_TEMPLATE_CONTENT_START}
|
|
1395
|
-
${content.bodyHtml}
|
|
1396
|
-
${HTML_PAGE_TEMPLATE_CONTENT_END}` : escapeHtml3(value ?? "")
|
|
1397
|
-
};
|
|
1327
|
+
const markup = slotMarkup(slot.name);
|
|
1328
|
+
if (markup !== void 0) {
|
|
1329
|
+
const replacement = { start: slot.start, end: slot.end, text: markup };
|
|
1398
1330
|
edits.push(replacement);
|
|
1399
1331
|
replacements.add(replacement);
|
|
1400
1332
|
} else {
|
|
@@ -1415,8 +1347,8 @@ ${HTML_PAGE_TEMPLATE_CONTENT_END}` : escapeHtml3(value ?? "")
|
|
|
1415
1347
|
}
|
|
1416
1348
|
for (const tag of tags) {
|
|
1417
1349
|
if (tag.kind !== "start" || tag.name !== "meta" || tag.inert) continue;
|
|
1418
|
-
const key = (
|
|
1419
|
-
const value = key ? metaValue(key, content.title, values.description) : void 0;
|
|
1350
|
+
const key = metaKey(tag);
|
|
1351
|
+
const value = key ? metaValue(key, content.title, values.description, image) : void 0;
|
|
1420
1352
|
if (value === void 0) continue;
|
|
1421
1353
|
const contentAttribute = tag.attributes.find((attribute) => attribute.name === "content");
|
|
1422
1354
|
const text = `content="${escapeAttr2(value)}"`;
|
|
@@ -1693,11 +1625,34 @@ function fillTitleText(text, valueFor) {
|
|
|
1693
1625
|
}
|
|
1694
1626
|
var TITLE_META = /* @__PURE__ */ new Set(["og:title", "twitter:title"]);
|
|
1695
1627
|
var DESCRIPTION_META = /* @__PURE__ */ new Set(["description", "og:description", "twitter:description"]);
|
|
1696
|
-
|
|
1628
|
+
var IMAGE_URL_META = /* @__PURE__ */ new Set([
|
|
1629
|
+
"og:image",
|
|
1630
|
+
"og:image:url",
|
|
1631
|
+
"og:image:secure_url",
|
|
1632
|
+
"twitter:image",
|
|
1633
|
+
"twitter:image:src"
|
|
1634
|
+
]);
|
|
1635
|
+
var IMAGE_ALT_META = /* @__PURE__ */ new Set(["og:image:alt", "twitter:image:alt"]);
|
|
1636
|
+
function metaKey(tag) {
|
|
1637
|
+
return (attributeValue(tag, "name") ?? attributeValue(tag, "property"))?.toLowerCase();
|
|
1638
|
+
}
|
|
1639
|
+
function metaValue(key, title, description, image) {
|
|
1697
1640
|
if (TITLE_META.has(key)) return title;
|
|
1698
1641
|
if (DESCRIPTION_META.has(key)) return description;
|
|
1642
|
+
if (!image) return void 0;
|
|
1643
|
+
if (IMAGE_URL_META.has(key)) return image.url;
|
|
1644
|
+
if (IMAGE_ALT_META.has(key)) return image.alt;
|
|
1645
|
+
if (key === "og:image:width" || key === "og:image:height") {
|
|
1646
|
+
const size = key === "og:image:width" ? image.width : image.height;
|
|
1647
|
+
return size === void 0 ? void 0 : String(size);
|
|
1648
|
+
}
|
|
1649
|
+
if (key === "og:image:type") return image.type;
|
|
1699
1650
|
return void 0;
|
|
1700
1651
|
}
|
|
1652
|
+
function imageElement(image) {
|
|
1653
|
+
const size = image.width !== void 0 && image.height !== void 0 ? ` width="${String(image.width)}" height="${String(image.height)}"` : "";
|
|
1654
|
+
return `<img src="${escapeAttr2(image.src ?? image.url)}" alt="${escapeAttr2(image.alt ?? "")}"${size}>`;
|
|
1655
|
+
}
|
|
1701
1656
|
function headInsertionPoint(tags) {
|
|
1702
1657
|
for (const tag of tags) {
|
|
1703
1658
|
if (tag.inert) continue;
|
|
@@ -2765,12 +2720,11 @@ export {
|
|
|
2765
2720
|
generateExternalHtml,
|
|
2766
2721
|
markdownDocToPlainHtml,
|
|
2767
2722
|
markdownDocToPlainHtmlParts,
|
|
2768
|
-
needsPlainHtmlPreparation,
|
|
2769
|
-
prepareMarkdownDocForPlainHtml,
|
|
2770
2723
|
markdownDocsToPlainHtmlBundle,
|
|
2771
2724
|
collectLinkRefs,
|
|
2772
2725
|
HTML_PAGE_TEMPLATE_CONTENT_START,
|
|
2773
2726
|
HTML_PAGE_TEMPLATE_CONTENT_END,
|
|
2727
|
+
HTML_PAGE_TEMPLATE_IMAGE_SLOT,
|
|
2774
2728
|
HtmlPageTemplateError,
|
|
2775
2729
|
isHtmlPageTemplate,
|
|
2776
2730
|
inspectHtmlPageTemplate,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OUTSIDE_IN_FORMAT_IDS,
|
|
3
|
+
OUTSIDE_IN_OUTPUT_TEMPLATE_KEY,
|
|
4
|
+
resolveOutsideInLayout
|
|
5
|
+
} from "./chunk-WJTC5OD6.js";
|
|
1
6
|
import {
|
|
2
7
|
convert,
|
|
3
8
|
defaultRegistry
|
|
4
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JINVU6QA.js";
|
|
5
10
|
import {
|
|
6
11
|
ConversionError
|
|
7
12
|
} from "./chunk-KXOZMWBS.js";
|
|
8
|
-
import {
|
|
9
|
-
OUTSIDE_IN_FORMAT_IDS,
|
|
10
|
-
OUTSIDE_IN_OUTPUT_TEMPLATE_KEY,
|
|
11
|
-
resolveOutsideInLayout
|
|
12
|
-
} from "./chunk-WJTC5OD6.js";
|
|
13
13
|
|
|
14
14
|
// src/outside-in/index.ts
|
|
15
15
|
import {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
2
|
+
import { P as PlainHtmlIcon } from '../plainHtml-B6IXcSet.js';
|
|
3
|
+
import '@bendyline/squisq/schemas';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Inline icons as SVG, for pages that should not depend on a font.
|
|
7
|
+
*
|
|
8
|
+
* A Font Awesome icon in the plain renderer is `<i class="fa-solid fa-star">`,
|
|
9
|
+
* which draws only where Font Awesome's stylesheet and fonts load — a CDN the
|
|
10
|
+
* page may not be allowed to reach, or a bundle it doesn't ship. Each icon's
|
|
11
|
+
* outline is read here from the same Font Awesome faces the DOCX, PDF and
|
|
12
|
+
* EPUB exporters embed, and drawn as a small inline `<svg>` instead: no font,
|
|
13
|
+
* no network, and it takes the text color like the glyph would.
|
|
14
|
+
*
|
|
15
|
+
* This module is its own entry, `@bendyline/squisq-formats/html-icons`, and
|
|
16
|
+
* nothing under `/html` may import it: the faces and their parser are ~2.5 MB,
|
|
17
|
+
* and a one-file bundle of `/html` would carry them even if it never drew an
|
|
18
|
+
* icon. Hosts pass `plainHtmlIcons` to `prepareMarkdownDocForPlainHtml`
|
|
19
|
+
* (`@bendyline/squisq-formats/html-prepare`) as `outlineIcons`.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The outline of every icon `doc` uses, keyed `family:name` — the `icons`
|
|
24
|
+
* option of `markdownDocToPlainHtml`. An icon the catalog doesn't know is left
|
|
25
|
+
* out and keeps its Font Awesome markup.
|
|
26
|
+
*/
|
|
27
|
+
declare function plainHtmlIcons(doc: MarkdownDocument): Promise<Map<string, PlainHtmlIcon>>;
|
|
28
|
+
|
|
29
|
+
export { plainHtmlIcons };
|
|
@@ -3,7 +3,7 @@ var fonts = /* @__PURE__ */ new Map();
|
|
|
3
3
|
function loadFont(family) {
|
|
4
4
|
let font = fonts.get(family);
|
|
5
5
|
if (!font) {
|
|
6
|
-
font = Promise.all([import("@pdf-lib/fontkit"), import("
|
|
6
|
+
font = Promise.all([import("@pdf-lib/fontkit"), import("../fontAwesome-C6FRDYTY.js")]).then(
|
|
7
7
|
([fontkit, { fontAwesomeFace }]) => fontkit.default.create(fontAwesomeFace(family).data)
|
|
8
8
|
);
|
|
9
9
|
font.catch(() => fonts.delete(family));
|
|
@@ -42,7 +42,7 @@ async function plainHtmlIcons(doc) {
|
|
|
42
42
|
const icons = /* @__PURE__ */ new Map();
|
|
43
43
|
const used = usedIcons(doc);
|
|
44
44
|
if (used.size === 0) return icons;
|
|
45
|
-
const { fontAwesomeGlyph } = await import("
|
|
45
|
+
const { fontAwesomeGlyph } = await import("../fontAwesome-C6FRDYTY.js");
|
|
46
46
|
for (const [key, [family, name]] of used) {
|
|
47
47
|
const glyph = fontAwesomeGlyph(family, name);
|
|
48
48
|
if (!glyph) continue;
|
package/dist/html/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Theme, ThemeRegistry, Doc } from '@bendyline/squisq/schemas';
|
|
2
2
|
import { H as HtmlExportOptions } from '../import-ipP4Ghp8.js';
|
|
3
3
|
export { a as HtmlImportOptions, c as collectImagePaths, g as generateExternalHtml, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from '../import-ipP4Ghp8.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
7
|
-
import { DiagramRasterizer } from '../diagrams/index.js';
|
|
4
|
+
export { a as PlainHtmlExportOptions, P as PlainHtmlIcon, b as PlainHtmlParts, m as markdownDocToPlainHtml, c as markdownDocToPlainHtmlParts } from '../plainHtml-B6IXcSet.js';
|
|
5
|
+
import { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Image Utilities for HTML Export
|
|
@@ -38,215 +36,6 @@ declare function arrayBufferToBase64DataUrl(buffer: ArrayBuffer, mimeType: strin
|
|
|
38
36
|
*/
|
|
39
37
|
declare function extractFilename(path: string): string;
|
|
40
38
|
|
|
41
|
-
/**
|
|
42
|
-
* Plain HTML Export — semantic, player-free
|
|
43
|
-
*
|
|
44
|
-
* Renders a MarkdownDocument to a self-contained HTML string. Unlike
|
|
45
|
-
* `docToHtml` (which bundles the SquisqPlayer IIFE and renders SVG block
|
|
46
|
-
* cards), this output is what a reader-mode tool would produce: semantic
|
|
47
|
-
* `<h1>`/`<p>`/`<ul>`/etc. with a small embedded stylesheet, no JS, no
|
|
48
|
-
* runtime path-rewriting. Drives both the "Page" preview tab in the
|
|
49
|
-
* editor and the plain-style branch of the export dialog so what users
|
|
50
|
-
* see live matches the file they download.
|
|
51
|
-
*
|
|
52
|
-
* Image URLs default to the markdown's own paths. Pass `images` to
|
|
53
|
-
* substitute a different value per source URL — typically pre-resolved
|
|
54
|
-
* blob URLs (live preview) or data URIs (single-file export).
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
interface PlainHtmlExportOptions {
|
|
58
|
-
/** Document title — populates `<title>` and is HTML-escaped. */
|
|
59
|
-
title?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Substitution map for image `src` URLs. Keys are the URL exactly as
|
|
62
|
-
* it appears in the markdown source; values are the URL to emit in
|
|
63
|
-
* the rendered `<img src>`. URLs not present in the map fall through
|
|
64
|
-
* unchanged (so external `https://…` references still work).
|
|
65
|
-
*/
|
|
66
|
-
images?: Map<string, string>;
|
|
67
|
-
/**
|
|
68
|
-
* Substitution map for anchor `href` URLs. Keys are the URL exactly
|
|
69
|
-
* as it appears in the markdown source (e.g. `'resume.md'`,
|
|
70
|
-
* `'resume.md#experience'`); values are the URL to emit. URLs not in
|
|
71
|
-
* the map pass through unchanged. Used by the recursive bundle
|
|
72
|
-
* exporter to rewrite `.md` references to `.html` so a static export
|
|
73
|
-
* of a linked document tree is internally browsable.
|
|
74
|
-
*/
|
|
75
|
-
links?: Map<string, string>;
|
|
76
|
-
/**
|
|
77
|
-
* Optional Squisq theme. When provided, the rendered page uses the
|
|
78
|
-
* theme's colors and typography, and any Google-hosted fonts the
|
|
79
|
-
* theme references are loaded via a `<link>` to fonts.googleapis.com
|
|
80
|
-
* so the face renders correctly without host preloads.
|
|
81
|
-
*
|
|
82
|
-
* When omitted, the function falls back (in order) to {@link themeId}
|
|
83
|
-
* and then to `doc.frontmatter.themeId` — so an authored
|
|
84
|
-
* `themeId: warm-earth` in the doc's frontmatter styles the export
|
|
85
|
-
* automatically, without the caller having to wire theme resolution
|
|
86
|
-
* themselves.
|
|
87
|
-
*/
|
|
88
|
-
theme?: Theme;
|
|
89
|
-
/**
|
|
90
|
-
* Optional theme id (e.g. `'warm-earth'`, `'gezellig'`). Convenient
|
|
91
|
-
* for hosts whose export dialog tracks themes by id — they can pass
|
|
92
|
-
* the id straight through instead of resolving to a `Theme` object.
|
|
93
|
-
* When both `theme` and `themeId` are provided, `theme` wins.
|
|
94
|
-
*/
|
|
95
|
-
themeId?: string;
|
|
96
|
-
/** Explicit caller-owned registry for non-document custom themes. */
|
|
97
|
-
themeRegistry?: ThemeRegistry;
|
|
98
|
-
/**
|
|
99
|
-
* Optional FontAwesome CSS text to inline into the rendered page,
|
|
100
|
-
* replacing the default cross-origin `<link>` to cdnjs. Required for
|
|
101
|
-
* sandboxed iframe previews where tracking prevention or stricter
|
|
102
|
-
* origin policies can silently drop cross-origin font fetches —
|
|
103
|
-
* inlining keeps the icons resolvable purely from same-origin
|
|
104
|
-
* resources. Hosts typically gather this string by scraping
|
|
105
|
-
* `document.styleSheets` for `@font-face` rules whose family starts
|
|
106
|
-
* with `"Font Awesome"`. A CDN `<link>` is emitted only when this option
|
|
107
|
-
* is absent and {@link externalResources} is explicitly `allow`.
|
|
108
|
-
*/
|
|
109
|
-
iconsCss?: string;
|
|
110
|
-
/**
|
|
111
|
-
* Whether this exporter may add remote font/icon stylesheets. Defaults to
|
|
112
|
-
* `deny`, keeping the generated file self-contained. Authored links and
|
|
113
|
-
* images are unaffected; bundle exporters are responsible for inlining or
|
|
114
|
-
* rewriting those document resources.
|
|
115
|
-
*/
|
|
116
|
-
externalResources?: 'deny' | 'allow';
|
|
117
|
-
/**
|
|
118
|
-
* Raw HTML policy. Defaults to `sanitize`, which removes unsafe tags,
|
|
119
|
-
* event handlers, and executable URL schemes before emitting HTML.
|
|
120
|
-
*/
|
|
121
|
-
htmlPolicy?: HtmlPolicy;
|
|
122
|
-
/**
|
|
123
|
-
* How a hosted video (a paragraph that is only a link to a YouTube, Vimeo,
|
|
124
|
-
* Loom or Wistia page, or that provider's `<iframe>` embed
|
|
125
|
-
* code) renders:
|
|
126
|
-
*
|
|
127
|
-
* - `player` (default) — the provider's player iframe;
|
|
128
|
-
* - `poster` — a static card linking to the video's page (the provider's
|
|
129
|
-
* thumbnail where it serves one). For contexts where a player cannot run:
|
|
130
|
-
* a preview iframe sandboxed without `allow-scripts` (nested frames
|
|
131
|
-
* inherit the sandbox, so the player would load broken), or print.
|
|
132
|
-
*/
|
|
133
|
-
videoEmbeds?: 'player' | 'poster';
|
|
134
|
-
/**
|
|
135
|
-
* Inline icons as SVG, keyed `family:name` (`solid:star`) — the `icons` that
|
|
136
|
-
* `prepareMarkdownDocForPlainHtml` returns. An icon found here is drawn as
|
|
137
|
-
* an inline `<svg>` in the text color and needs no Font Awesome stylesheet;
|
|
138
|
-
* any other icon keeps its Font Awesome markup (see {@link iconsCss}).
|
|
139
|
-
*/
|
|
140
|
-
icons?: ReadonlyMap<string, PlainHtmlIcon>;
|
|
141
|
-
}
|
|
142
|
-
/** One icon's outline: an SVG path in a `0 0 width height` box whose height is 1em. */
|
|
143
|
-
interface PlainHtmlIcon {
|
|
144
|
-
width: number;
|
|
145
|
-
height: number;
|
|
146
|
-
path: string;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Render a parsed markdown document as a complete, semantic HTML page.
|
|
150
|
-
*
|
|
151
|
-
* When `options.theme` is provided, the output adopts the theme's
|
|
152
|
-
* colors and typography. Google-hosted fonts referenced by the theme
|
|
153
|
-
* are loaded via a single `<link>` to fonts.googleapis.com so the page
|
|
154
|
-
* renders consistently when opened standalone.
|
|
155
|
-
*/
|
|
156
|
-
declare function markdownDocToPlainHtml(doc: MarkdownDocument, options?: PlainHtmlExportOptions): string;
|
|
157
|
-
/**
|
|
158
|
-
* The pieces of a plain HTML page that belong to the document itself, for a
|
|
159
|
-
* host that places the document inside a page of its own (see
|
|
160
|
-
* `applyHtmlPageTemplate`).
|
|
161
|
-
*/
|
|
162
|
-
interface PlainHtmlParts {
|
|
163
|
-
/** The `title` option, unescaped. */
|
|
164
|
-
title: string;
|
|
165
|
-
/** The rendered document body, footnotes included. */
|
|
166
|
-
bodyHtml: string;
|
|
167
|
-
/**
|
|
168
|
-
* `<head>` markup for the CSS the body's own constructs need — feature
|
|
169
|
-
* sections, video embeds, SVG islands, icons — and nothing that styles the
|
|
170
|
-
* page around them: no theme typography, colors, fonts, or `body` rules.
|
|
171
|
-
*/
|
|
172
|
-
featureHeadHtml: string;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Render a document's body and the functional CSS it depends on, without the
|
|
176
|
-
* page shell or theme stylesheet `markdownDocToPlainHtml` wraps around them.
|
|
177
|
-
* The theme (when one resolves) still informs body rendering, such as the
|
|
178
|
-
* color an SVG island's `currentColor` follows.
|
|
179
|
-
*/
|
|
180
|
-
declare function markdownDocToPlainHtmlParts(doc: MarkdownDocument, options?: PlainHtmlExportOptions): PlainHtmlParts;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Preparing a document for a static HTML page.
|
|
184
|
-
*
|
|
185
|
-
* A plain HTML page (`markdownDocToPlainHtml`, or a page template filled from
|
|
186
|
-
* `markdownDocToPlainHtmlParts`) runs no script, so what the player draws at
|
|
187
|
-
* runtime has to be settled before the page is written:
|
|
188
|
-
*
|
|
189
|
-
* - `{[dataTable src=…]}` references (and charts fed by one) get the table
|
|
190
|
-
* they point at, bounded to a preview window with a "Showing N of M rows"
|
|
191
|
-
* note — the author's body link to the full file follows it;
|
|
192
|
-
* - Mermaid fences, ASCII diagrams and timelines, drawing / layout / diagram
|
|
193
|
-
* blocks, and charts become pictures, drawn by a host-supplied renderer
|
|
194
|
-
* (drawing needs a browser) and returned as `data:` URLs;
|
|
195
|
-
* - inline icons become inline SVG outlines, so the page needs no Font
|
|
196
|
-
* Awesome stylesheet or font.
|
|
197
|
-
*
|
|
198
|
-
* File trees stay preformatted text, which a page shows as well as a picture
|
|
199
|
-
* would and keeps selectable; SVG islands the renderer already draws.
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
|
-
interface PlainHtmlPreparationOptions {
|
|
203
|
-
/**
|
|
204
|
-
* Draws diagrams and charts as pictures. In a browser, pass
|
|
205
|
-
* `createDiagramPictureRenderer()` from
|
|
206
|
-
* `@bendyline/squisq-react/diagram-pictures`. Without one, diagrams stay as
|
|
207
|
-
* their source and charts as their table.
|
|
208
|
-
*/
|
|
209
|
-
renderDiagram?: DiagramRasterizer;
|
|
210
|
-
/**
|
|
211
|
-
* The container holding the document's data sidecars. Without one, a data
|
|
212
|
-
* reference keeps only its link.
|
|
213
|
-
*/
|
|
214
|
-
container?: ContentContainer | null;
|
|
215
|
-
/** Rows per data table; a block's own `previewRows` wins. Default 100. */
|
|
216
|
-
maxDataRows?: number;
|
|
217
|
-
/**
|
|
218
|
-
* A caller-owned memo of data-file reads, for a host that prepares the
|
|
219
|
-
* same document again and again (a live preview). The caller clears it
|
|
220
|
-
* when the files may have changed.
|
|
221
|
-
*/
|
|
222
|
-
dataTableCache?: Map<string, Promise<DataSourceTable>>;
|
|
223
|
-
signal?: AbortSignal;
|
|
224
|
-
/** Receives a note for each table or picture that could not be produced. */
|
|
225
|
-
onWarning?: (message: string) => void;
|
|
226
|
-
}
|
|
227
|
-
interface PreparedPlainHtmlDocument {
|
|
228
|
-
/** The document to render, with data tables filled in and pictures in place. */
|
|
229
|
-
markdownDoc: MarkdownDocument;
|
|
230
|
-
/**
|
|
231
|
-
* The pictures as `data:` URLs, keyed by the image URL written into
|
|
232
|
-
* `markdownDoc`. Merge them into the renderer's `images` option.
|
|
233
|
-
*/
|
|
234
|
-
images: Map<string, string>;
|
|
235
|
-
/** Outlines of the document's inline icons: the renderer's `icons` option. */
|
|
236
|
-
icons: Map<string, PlainHtmlIcon>;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Whether {@link prepareMarkdownDocForPlainHtml} would change anything for
|
|
240
|
-
* `doc` with these options — so a live preview renders a document with
|
|
241
|
-
* nothing to prepare at once, without waiting on the asynchronous step.
|
|
242
|
-
*/
|
|
243
|
-
declare function needsPlainHtmlPreparation(doc: MarkdownDocument, options?: Pick<PlainHtmlPreparationOptions, 'renderDiagram' | 'container'>): boolean;
|
|
244
|
-
/**
|
|
245
|
-
* Settle everything in `doc` a script-free page cannot draw. Never throws for
|
|
246
|
-
* one table or picture: each degrades to its link or source with a warning.
|
|
247
|
-
*/
|
|
248
|
-
declare function prepareMarkdownDocForPlainHtml(doc: MarkdownDocument, options?: PlainHtmlPreparationOptions): Promise<PreparedPlainHtmlDocument>;
|
|
249
|
-
|
|
250
39
|
/**
|
|
251
40
|
* HTML Page Templates
|
|
252
41
|
*
|
|
@@ -259,6 +48,8 @@ declare function prepareMarkdownDocForPlainHtml(doc: MarkdownDocument, options?:
|
|
|
259
48
|
* - `<slot name="title">` receives the document title, and
|
|
260
49
|
* `<slot name="KEY">` the caller's value for `KEY` (typically a
|
|
261
50
|
* frontmatter field), inserted as text;
|
|
51
|
+
* - `<slot name="og-image">` receives the page's social preview picture, when
|
|
52
|
+
* the caller supplies one, as an `<img>`;
|
|
262
53
|
* - a slot with no value is replaced by its children — the standard fallback
|
|
263
54
|
* content — so a template opened directly in a browser previews with its
|
|
264
55
|
* placeholders.
|
|
@@ -268,7 +59,7 @@ declare function prepareMarkdownDocForPlainHtml(doc: MarkdownDocument, options?:
|
|
|
268
59
|
*
|
|
269
60
|
* `<title>` cannot contain elements, so slots written inside it are matched
|
|
270
61
|
* as text; a `<title>` without one is replaced by the document title.
|
|
271
|
-
* Existing description and Open Graph / Twitter title and
|
|
62
|
+
* Existing description and Open Graph / Twitter title, description, and image
|
|
272
63
|
* `<meta>` tags receive the document's values. Relative URLs in the template
|
|
273
64
|
* are rewritten so they still resolve from the generated page's location.
|
|
274
65
|
*
|
|
@@ -280,6 +71,28 @@ declare function prepareMarkdownDocForPlainHtml(doc: MarkdownDocument, options?:
|
|
|
280
71
|
declare const HTML_PAGE_TEMPLATE_CONTENT_START = "<!-- squisq:content -->";
|
|
281
72
|
/** Marks the end of the injected document body in a templated page. */
|
|
282
73
|
declare const HTML_PAGE_TEMPLATE_CONTENT_END = "<!-- /squisq:content -->";
|
|
74
|
+
/** The named slot that receives the page's social preview picture. */
|
|
75
|
+
declare const HTML_PAGE_TEMPLATE_IMAGE_SLOT = "og-image";
|
|
76
|
+
/** A page's social preview picture: its Open Graph and Twitter card image. */
|
|
77
|
+
interface HtmlPageTemplateImage {
|
|
78
|
+
/**
|
|
79
|
+
* URL written to the image `<meta>` tags. Social sites expect an absolute
|
|
80
|
+
* URL; a relative one is written as given.
|
|
81
|
+
*/
|
|
82
|
+
url: string;
|
|
83
|
+
/**
|
|
84
|
+
* URL the `og-image` slot's `<img>` loads, typically relative to the page
|
|
85
|
+
* so it also shows before the site is published. Default: {@link url}.
|
|
86
|
+
*/
|
|
87
|
+
src?: string;
|
|
88
|
+
/** Size in pixels. */
|
|
89
|
+
width?: number;
|
|
90
|
+
height?: number;
|
|
91
|
+
/** Text alternative. */
|
|
92
|
+
alt?: string;
|
|
93
|
+
/** Media type, such as `image/png`. */
|
|
94
|
+
type?: string;
|
|
95
|
+
}
|
|
283
96
|
interface HtmlPageTemplateContent {
|
|
284
97
|
/** Rendered document body. Inserted as-is; the caller sanitizes it. */
|
|
285
98
|
bodyHtml: string;
|
|
@@ -293,9 +106,16 @@ interface HtmlPageTemplateContent {
|
|
|
293
106
|
title: string;
|
|
294
107
|
/**
|
|
295
108
|
* Text for named slots, keyed by slot name. `description` also fills
|
|
296
|
-
* description `<meta>` tags. `title` comes from {@link title}
|
|
109
|
+
* description `<meta>` tags. `title` comes from {@link title}, and
|
|
110
|
+
* `og-image` from {@link image}.
|
|
297
111
|
*/
|
|
298
112
|
values?: Readonly<Record<string, string | undefined>>;
|
|
113
|
+
/**
|
|
114
|
+
* The page's social preview picture. Fills the template's `og-image` slot
|
|
115
|
+
* and the Open Graph / Twitter image `<meta>` tags it declares; without
|
|
116
|
+
* one, both keep what the template wrote.
|
|
117
|
+
*/
|
|
118
|
+
image?: HtmlPageTemplateImage;
|
|
299
119
|
}
|
|
300
120
|
interface HtmlPageTemplateOptions {
|
|
301
121
|
/**
|
|
@@ -322,6 +142,12 @@ interface HtmlPageTemplateInspection {
|
|
|
322
142
|
defaultSlotCount: number;
|
|
323
143
|
/** Distinct named slots, in document order. */
|
|
324
144
|
namedSlots: string[];
|
|
145
|
+
/**
|
|
146
|
+
* True when a supplied {@link HtmlPageTemplateContent.image} would appear
|
|
147
|
+
* in the page: the template has an `og-image` slot or an Open Graph /
|
|
148
|
+
* Twitter image `<meta>` tag. A host can skip drawing a picture otherwise.
|
|
149
|
+
*/
|
|
150
|
+
usesImage: boolean;
|
|
325
151
|
/** Problems that make {@link applyHtmlPageTemplate} refuse the template. */
|
|
326
152
|
errors: HtmlPageTemplateIssue[];
|
|
327
153
|
}
|
|
@@ -561,4 +387,4 @@ declare function docToHtml(doc: Doc, options: HtmlExportOptions): string;
|
|
|
561
387
|
*/
|
|
562
388
|
declare function docToHtmlZip(doc: Doc, options: HtmlZipExportOptions): Promise<Blob>;
|
|
563
389
|
|
|
564
|
-
export { HTML_PAGE_TEMPLATE_CONTENT_END, HTML_PAGE_TEMPLATE_CONTENT_START, type HtmlBundleOptions, HtmlExportOptions, type HtmlPageTemplateContent, HtmlPageTemplateError, type HtmlPageTemplateInspection, type HtmlPageTemplateIssue, type HtmlPageTemplateOptions, type HtmlZipExportOptions, type PlainHtmlBundleOptions,
|
|
390
|
+
export { HTML_PAGE_TEMPLATE_CONTENT_END, HTML_PAGE_TEMPLATE_CONTENT_START, HTML_PAGE_TEMPLATE_IMAGE_SLOT, type HtmlBundleOptions, HtmlExportOptions, type HtmlPageTemplateContent, HtmlPageTemplateError, type HtmlPageTemplateImage, type HtmlPageTemplateInspection, type HtmlPageTemplateIssue, type HtmlPageTemplateOptions, type HtmlZipExportOptions, type PlainHtmlBundleOptions, applyHtmlPageTemplate, arrayBufferToBase64DataUrl, collectLinkRefs, docToHtml, docToHtmlZip, extractFilename, extractHtmlPageTemplateContent, inferMimeType, inspectHtmlPageTemplate, isHtmlPageTemplate, markdownDocsToHtmlBundle, markdownDocsToPlainHtmlBundle };
|
package/dist/html/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HTML_PAGE_TEMPLATE_CONTENT_END,
|
|
3
3
|
HTML_PAGE_TEMPLATE_CONTENT_START,
|
|
4
|
+
HTML_PAGE_TEMPLATE_IMAGE_SLOT,
|
|
4
5
|
HtmlPageTemplateError,
|
|
5
6
|
applyHtmlPageTemplate,
|
|
6
7
|
collectImagePaths,
|
|
@@ -17,11 +18,8 @@ import {
|
|
|
17
18
|
markdownDocToPlainHtml,
|
|
18
19
|
markdownDocToPlainHtmlParts,
|
|
19
20
|
markdownDocsToHtmlBundle,
|
|
20
|
-
markdownDocsToPlainHtmlBundle
|
|
21
|
-
|
|
22
|
-
prepareMarkdownDocForPlainHtml
|
|
23
|
-
} from "../chunk-SZ3OIY6G.js";
|
|
24
|
-
import "../chunk-4LIFEQKX.js";
|
|
21
|
+
markdownDocsToPlainHtmlBundle
|
|
22
|
+
} from "../chunk-4SPMLGOG.js";
|
|
25
23
|
import {
|
|
26
24
|
arrayBufferToBase64DataUrl,
|
|
27
25
|
extractFilename,
|
|
@@ -33,6 +31,7 @@ import "../chunk-JZR32FON.js";
|
|
|
33
31
|
export {
|
|
34
32
|
HTML_PAGE_TEMPLATE_CONTENT_END,
|
|
35
33
|
HTML_PAGE_TEMPLATE_CONTENT_START,
|
|
34
|
+
HTML_PAGE_TEMPLATE_IMAGE_SLOT,
|
|
36
35
|
HtmlPageTemplateError,
|
|
37
36
|
applyHtmlPageTemplate,
|
|
38
37
|
arrayBufferToBase64DataUrl,
|
|
@@ -52,7 +51,5 @@ export {
|
|
|
52
51
|
markdownDocToPlainHtml,
|
|
53
52
|
markdownDocToPlainHtmlParts,
|
|
54
53
|
markdownDocsToHtmlBundle,
|
|
55
|
-
markdownDocsToPlainHtmlBundle
|
|
56
|
-
needsPlainHtmlPreparation,
|
|
57
|
-
prepareMarkdownDocForPlainHtml
|
|
54
|
+
markdownDocsToPlainHtmlBundle
|
|
58
55
|
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
2
|
+
import { DataSourceTable } from '@bendyline/squisq/doc';
|
|
3
|
+
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
4
|
+
import { DiagramRasterizer } from '../diagrams/index.js';
|
|
5
|
+
import { P as PlainHtmlIcon } from '../plainHtml-B6IXcSet.js';
|
|
6
|
+
import '@bendyline/squisq/schemas';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Preparing a document for a static HTML page.
|
|
10
|
+
*
|
|
11
|
+
* A plain HTML page (`markdownDocToPlainHtml`, or a page template filled from
|
|
12
|
+
* `markdownDocToPlainHtmlParts`) runs no script, so what the player draws at
|
|
13
|
+
* runtime has to be settled before the page is written:
|
|
14
|
+
*
|
|
15
|
+
* - `{[dataTable src=…]}` references (and charts fed by one) get the table
|
|
16
|
+
* they point at, bounded to a preview window with a "Showing N of M rows"
|
|
17
|
+
* note — the author's body link to the full file follows it;
|
|
18
|
+
* - Mermaid fences, ASCII diagrams and timelines, drawing / layout / diagram
|
|
19
|
+
* blocks, and charts become pictures, drawn by a host-supplied renderer
|
|
20
|
+
* (drawing needs a browser) and returned as `data:` URLs;
|
|
21
|
+
* - inline icons become inline SVG outlines, drawn by a host-supplied
|
|
22
|
+
* outliner (`plainHtmlIcons` from `@bendyline/squisq-formats/html-icons`),
|
|
23
|
+
* so the page needs no Font Awesome stylesheet or font.
|
|
24
|
+
*
|
|
25
|
+
* File trees stay preformatted text, which a page shows as well as a picture
|
|
26
|
+
* would and keeps selectable; SVG islands the renderer already draws.
|
|
27
|
+
*
|
|
28
|
+
* This module is its own entry, `@bendyline/squisq-formats/html-prepare`, and
|
|
29
|
+
* nothing under `/html` imports it. A bundler that writes one file inlines
|
|
30
|
+
* every dynamic import it can reach, and filling data tables reaches the XLSX
|
|
31
|
+
* reader (an XML parser and zip code, ~300 KB) that a host only rendering
|
|
32
|
+
* plain HTML — say, an editor-extension host — must not carry. Both drawing
|
|
33
|
+
* steps are the host's to pass in for the same reason: the icon outlines alone
|
|
34
|
+
* (Font Awesome's faces and their parser) are ~2.5 MB.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Outlines the inline icons `doc` uses, keyed `family:name` — the renderer's
|
|
39
|
+
* `icons` option. `plainHtmlIcons` from `@bendyline/squisq-formats/html-icons`
|
|
40
|
+
* is one.
|
|
41
|
+
*/
|
|
42
|
+
type PlainHtmlIconOutliner = (doc: MarkdownDocument) => Promise<Map<string, PlainHtmlIcon>>;
|
|
43
|
+
interface PlainHtmlPreparationOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Draws diagrams and charts as pictures. In a browser, pass
|
|
46
|
+
* `createDiagramPictureRenderer()` from
|
|
47
|
+
* `@bendyline/squisq-react/diagram-pictures`. Without one, diagrams stay as
|
|
48
|
+
* their source and charts as their table.
|
|
49
|
+
*/
|
|
50
|
+
renderDiagram?: DiagramRasterizer;
|
|
51
|
+
/**
|
|
52
|
+
* Draws inline icons as SVG outlines. Pass `plainHtmlIcons` from
|
|
53
|
+
* `@bendyline/squisq-formats/html-icons`; it needs no browser. Without one,
|
|
54
|
+
* icons keep their Font Awesome markup.
|
|
55
|
+
*/
|
|
56
|
+
outlineIcons?: PlainHtmlIconOutliner;
|
|
57
|
+
/**
|
|
58
|
+
* The container holding the document's data sidecars. Without one, a data
|
|
59
|
+
* reference keeps only its link.
|
|
60
|
+
*/
|
|
61
|
+
container?: ContentContainer | null;
|
|
62
|
+
/** Rows per data table; a block's own `previewRows` wins. Default 100. */
|
|
63
|
+
maxDataRows?: number;
|
|
64
|
+
/**
|
|
65
|
+
* A caller-owned memo of data-file reads, for a host that prepares the
|
|
66
|
+
* same document again and again (a live preview). The caller clears it
|
|
67
|
+
* when the files may have changed.
|
|
68
|
+
*/
|
|
69
|
+
dataTableCache?: Map<string, Promise<DataSourceTable>>;
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
/** Receives a note for each table or picture that could not be produced. */
|
|
72
|
+
onWarning?: (message: string) => void;
|
|
73
|
+
}
|
|
74
|
+
interface PreparedPlainHtmlDocument {
|
|
75
|
+
/** The document to render, with data tables filled in and pictures in place. */
|
|
76
|
+
markdownDoc: MarkdownDocument;
|
|
77
|
+
/**
|
|
78
|
+
* The pictures as `data:` URLs, keyed by the image URL written into
|
|
79
|
+
* `markdownDoc`. Merge them into the renderer's `images` option.
|
|
80
|
+
*/
|
|
81
|
+
images: Map<string, string>;
|
|
82
|
+
/** Outlines of the document's inline icons: the renderer's `icons` option. */
|
|
83
|
+
icons: Map<string, PlainHtmlIcon>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Whether {@link prepareMarkdownDocForPlainHtml} would change anything for
|
|
87
|
+
* `doc` with these options — so a live preview renders a document with
|
|
88
|
+
* nothing to prepare at once, without waiting on the asynchronous step.
|
|
89
|
+
*/
|
|
90
|
+
declare function needsPlainHtmlPreparation(doc: MarkdownDocument, options?: Pick<PlainHtmlPreparationOptions, 'renderDiagram' | 'outlineIcons' | 'container'>): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Settle everything in `doc` a script-free page cannot draw. Never throws for
|
|
93
|
+
* one table or picture: each degrades to its link or source with a warning.
|
|
94
|
+
*/
|
|
95
|
+
declare function prepareMarkdownDocForPlainHtml(doc: MarkdownDocument, options?: PlainHtmlPreparationOptions): Promise<PreparedPlainHtmlDocument>;
|
|
96
|
+
|
|
97
|
+
export { type PlainHtmlIconOutliner, type PlainHtmlPreparationOptions, type PreparedPlainHtmlDocument, needsPlainHtmlPreparation, prepareMarkdownDocForPlainHtml };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findDiagrams,
|
|
3
|
+
rasterizeDiagrams
|
|
4
|
+
} from "../chunk-4LIFEQKX.js";
|
|
5
|
+
import {
|
|
6
|
+
arrayBufferToBase64DataUrl
|
|
7
|
+
} from "../chunk-WMIDXNGR.js";
|
|
8
|
+
import "../chunk-JZR32FON.js";
|
|
9
|
+
|
|
10
|
+
// src/html/plainHtmlPrepare.ts
|
|
11
|
+
import { isDataFilePath } from "@bendyline/squisq/doc";
|
|
12
|
+
var PAGE_DIAGRAM_KINDS = [
|
|
13
|
+
"mermaid",
|
|
14
|
+
"diagram",
|
|
15
|
+
"timeline",
|
|
16
|
+
"container",
|
|
17
|
+
"chart"
|
|
18
|
+
];
|
|
19
|
+
function needsPlainHtmlPreparation(doc, options = {}) {
|
|
20
|
+
let icons = false;
|
|
21
|
+
let data = false;
|
|
22
|
+
const visit = (node) => {
|
|
23
|
+
if (!node || typeof node !== "object" || icons && data) return;
|
|
24
|
+
const n = node;
|
|
25
|
+
if (n.type === "inlineIcon") icons = true;
|
|
26
|
+
if (n.type === "heading") {
|
|
27
|
+
const src = n.templateAnnotation?.params?.src;
|
|
28
|
+
if (src && isDataFilePath(src)) data = true;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(n.children)) n.children.forEach(visit);
|
|
31
|
+
};
|
|
32
|
+
doc.children.forEach(visit);
|
|
33
|
+
if (icons && options.outlineIcons || data && options.container) return true;
|
|
34
|
+
if (!options.renderDiagram) return false;
|
|
35
|
+
return findDiagrams(doc).some((diagram) => PAGE_DIAGRAM_KINDS.includes(diagram.kind));
|
|
36
|
+
}
|
|
37
|
+
async function prepareMarkdownDocForPlainHtml(doc, options = {}) {
|
|
38
|
+
const { renderDiagram, outlineIcons, container, signal, onWarning } = options;
|
|
39
|
+
let markdownDoc = doc;
|
|
40
|
+
if (container) {
|
|
41
|
+
const { materializeDataReferences, DATA_PREVIEW_ROWS } = await import("../materialize-ICXNO4S4.js");
|
|
42
|
+
markdownDoc = await materializeDataReferences(markdownDoc, container, onWarning, {
|
|
43
|
+
maxRows: options.maxDataRows ?? DATA_PREVIEW_ROWS,
|
|
44
|
+
tableCache: options.dataTableCache
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
signal?.throwIfAborted();
|
|
48
|
+
const icons = outlineIcons ? await outlineIcons(markdownDoc) : /* @__PURE__ */ new Map();
|
|
49
|
+
const images = /* @__PURE__ */ new Map();
|
|
50
|
+
if (!renderDiagram) return { markdownDoc, images, icons };
|
|
51
|
+
const pictured = await rasterizeDiagrams(markdownDoc, renderDiagram, {
|
|
52
|
+
kinds: PAGE_DIAGRAM_KINDS,
|
|
53
|
+
urlPrefix: "squisq-picture",
|
|
54
|
+
signal,
|
|
55
|
+
onWarning
|
|
56
|
+
});
|
|
57
|
+
const widths = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const [url, picture] of pictured.images) {
|
|
59
|
+
const bytes = picture.data;
|
|
60
|
+
const buffer = bytes.buffer.slice(
|
|
61
|
+
bytes.byteOffset,
|
|
62
|
+
bytes.byteOffset + bytes.byteLength
|
|
63
|
+
);
|
|
64
|
+
images.set(url, arrayBufferToBase64DataUrl(buffer, picture.contentType));
|
|
65
|
+
widths.set(url, Math.round(picture.width));
|
|
66
|
+
}
|
|
67
|
+
return { markdownDoc: withPictureWidths(pictured.markdownDoc, widths), images, icons };
|
|
68
|
+
}
|
|
69
|
+
function withPictureWidths(doc, widths) {
|
|
70
|
+
if (widths.size === 0) return doc;
|
|
71
|
+
const visit = (node) => {
|
|
72
|
+
if (node.type === "image") {
|
|
73
|
+
const width = widths.get(node.url);
|
|
74
|
+
return width === void 0 ? node : { ...node, width };
|
|
75
|
+
}
|
|
76
|
+
const children = node.children;
|
|
77
|
+
if (!Array.isArray(children)) return node;
|
|
78
|
+
return { ...node, children: children.map(visit) };
|
|
79
|
+
};
|
|
80
|
+
return { ...doc, children: doc.children.map(visit) };
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
needsPlainHtmlPreparation,
|
|
84
|
+
prepareMarkdownDocForPlainHtml
|
|
85
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ import '@bendyline/squisq/markdown';
|
|
|
19
19
|
import './reader-B_m1aKZC.js';
|
|
20
20
|
import '@bendyline/squisq/storage';
|
|
21
21
|
import './layouts-CTdPlB-u.js';
|
|
22
|
-
import '
|
|
23
|
-
import './diagrams/index.js';
|
|
22
|
+
import './plainHtml-B6IXcSet.js';
|
|
24
23
|
import './themeReader-DCtwC83Q.js';
|
|
25
24
|
import '@bendyline/squisq/transform';
|
|
26
25
|
import './container/index.js';
|
|
26
|
+
import './diagrams/index.js';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
htmlToMarkdown,
|
|
6
6
|
htmlToMarkdownDoc,
|
|
7
7
|
htmlToMarkdownDocSync
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4SPMLGOG.js";
|
|
9
9
|
import {
|
|
10
10
|
docToEpub,
|
|
11
11
|
markdownDocToEpub
|
|
@@ -29,7 +29,14 @@ import {
|
|
|
29
29
|
renderOutsideInDocument,
|
|
30
30
|
withOutsideInMarkdownEditing,
|
|
31
31
|
withOutsideInMetadata
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-D2JA3MLG.js";
|
|
33
|
+
import {
|
|
34
|
+
OUTSIDE_IN_FORMAT_IDS,
|
|
35
|
+
OUTSIDE_IN_OUTPUT_TEMPLATE_KEY,
|
|
36
|
+
chooseOutsideInMarkdownPath,
|
|
37
|
+
isOutsideInTargetPath,
|
|
38
|
+
resolveOutsideInLayout
|
|
39
|
+
} from "./chunk-WJTC5OD6.js";
|
|
33
40
|
import {
|
|
34
41
|
DEFAULT_CONVERSION_LIMITS,
|
|
35
42
|
convert,
|
|
@@ -38,18 +45,10 @@ import {
|
|
|
38
45
|
defaultRegistry,
|
|
39
46
|
prepareConversion,
|
|
40
47
|
resolveConversionLimits
|
|
41
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-JINVU6QA.js";
|
|
42
49
|
import {
|
|
43
50
|
ConversionError
|
|
44
51
|
} from "./chunk-KXOZMWBS.js";
|
|
45
|
-
import {
|
|
46
|
-
OUTSIDE_IN_FORMAT_IDS,
|
|
47
|
-
OUTSIDE_IN_OUTPUT_TEMPLATE_KEY,
|
|
48
|
-
chooseOutsideInMarkdownPath,
|
|
49
|
-
isOutsideInTargetPath,
|
|
50
|
-
resolveOutsideInLayout
|
|
51
|
-
} from "./chunk-WJTC5OD6.js";
|
|
52
|
-
import "./chunk-4LIFEQKX.js";
|
|
53
52
|
import {
|
|
54
53
|
docToDocx,
|
|
55
54
|
docxToDoc,
|
|
@@ -61,7 +60,7 @@ import {
|
|
|
61
60
|
markdownDocToPptx,
|
|
62
61
|
pptxToDoc,
|
|
63
62
|
pptxToMarkdownDoc
|
|
64
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-S5VXWSRR.js";
|
|
65
64
|
import "./chunk-6N2J7C2B.js";
|
|
66
65
|
import "./chunk-WMIDXNGR.js";
|
|
67
66
|
import "./chunk-DHAK4PII.js";
|
package/dist/outside-in/index.js
CHANGED
|
@@ -7,9 +7,7 @@ import {
|
|
|
7
7
|
renderOutsideInDocument,
|
|
8
8
|
withOutsideInMarkdownEditing,
|
|
9
9
|
withOutsideInMetadata
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-WVDAFJFS.js";
|
|
12
|
-
import "../chunk-KXOZMWBS.js";
|
|
10
|
+
} from "../chunk-D2JA3MLG.js";
|
|
13
11
|
import {
|
|
14
12
|
OUTSIDE_IN_FORMAT_IDS,
|
|
15
13
|
OUTSIDE_IN_OUTPUT_TEMPLATE_KEY,
|
|
@@ -17,6 +15,8 @@ import {
|
|
|
17
15
|
isOutsideInTargetPath,
|
|
18
16
|
resolveOutsideInLayout
|
|
19
17
|
} from "../chunk-WJTC5OD6.js";
|
|
18
|
+
import "../chunk-JINVU6QA.js";
|
|
19
|
+
import "../chunk-KXOZMWBS.js";
|
|
20
20
|
import "../chunk-7AWFHP5U.js";
|
|
21
21
|
export {
|
|
22
22
|
OUTSIDE_IN_FORMAT_IDS,
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { HtmlPolicy, MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
2
|
+
import { Theme, ThemeRegistry } from '@bendyline/squisq/schemas';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Plain HTML Export — semantic, player-free
|
|
6
|
+
*
|
|
7
|
+
* Renders a MarkdownDocument to a self-contained HTML string. Unlike
|
|
8
|
+
* `docToHtml` (which bundles the SquisqPlayer IIFE and renders SVG block
|
|
9
|
+
* cards), this output is what a reader-mode tool would produce: semantic
|
|
10
|
+
* `<h1>`/`<p>`/`<ul>`/etc. with a small embedded stylesheet, no JS, no
|
|
11
|
+
* runtime path-rewriting. Drives both the "Page" preview tab in the
|
|
12
|
+
* editor and the plain-style branch of the export dialog so what users
|
|
13
|
+
* see live matches the file they download.
|
|
14
|
+
*
|
|
15
|
+
* Image URLs default to the markdown's own paths. Pass `images` to
|
|
16
|
+
* substitute a different value per source URL — typically pre-resolved
|
|
17
|
+
* blob URLs (live preview) or data URIs (single-file export).
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface PlainHtmlExportOptions {
|
|
21
|
+
/** Document title — populates `<title>` and is HTML-escaped. */
|
|
22
|
+
title?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Substitution map for image `src` URLs. Keys are the URL exactly as
|
|
25
|
+
* it appears in the markdown source; values are the URL to emit in
|
|
26
|
+
* the rendered `<img src>`. URLs not present in the map fall through
|
|
27
|
+
* unchanged (so external `https://…` references still work).
|
|
28
|
+
*/
|
|
29
|
+
images?: Map<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Substitution map for anchor `href` URLs. Keys are the URL exactly
|
|
32
|
+
* as it appears in the markdown source (e.g. `'resume.md'`,
|
|
33
|
+
* `'resume.md#experience'`); values are the URL to emit. URLs not in
|
|
34
|
+
* the map pass through unchanged. Used by the recursive bundle
|
|
35
|
+
* exporter to rewrite `.md` references to `.html` so a static export
|
|
36
|
+
* of a linked document tree is internally browsable.
|
|
37
|
+
*/
|
|
38
|
+
links?: Map<string, string>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional Squisq theme. When provided, the rendered page uses the
|
|
41
|
+
* theme's colors and typography, and any Google-hosted fonts the
|
|
42
|
+
* theme references are loaded via a `<link>` to fonts.googleapis.com
|
|
43
|
+
* so the face renders correctly without host preloads.
|
|
44
|
+
*
|
|
45
|
+
* When omitted, the function falls back (in order) to {@link themeId}
|
|
46
|
+
* and then to `doc.frontmatter.themeId` — so an authored
|
|
47
|
+
* `themeId: warm-earth` in the doc's frontmatter styles the export
|
|
48
|
+
* automatically, without the caller having to wire theme resolution
|
|
49
|
+
* themselves.
|
|
50
|
+
*/
|
|
51
|
+
theme?: Theme;
|
|
52
|
+
/**
|
|
53
|
+
* Optional theme id (e.g. `'warm-earth'`, `'gezellig'`). Convenient
|
|
54
|
+
* for hosts whose export dialog tracks themes by id — they can pass
|
|
55
|
+
* the id straight through instead of resolving to a `Theme` object.
|
|
56
|
+
* When both `theme` and `themeId` are provided, `theme` wins.
|
|
57
|
+
*/
|
|
58
|
+
themeId?: string;
|
|
59
|
+
/** Explicit caller-owned registry for non-document custom themes. */
|
|
60
|
+
themeRegistry?: ThemeRegistry;
|
|
61
|
+
/**
|
|
62
|
+
* Optional FontAwesome CSS text to inline into the rendered page,
|
|
63
|
+
* replacing the default cross-origin `<link>` to cdnjs. Required for
|
|
64
|
+
* sandboxed iframe previews where tracking prevention or stricter
|
|
65
|
+
* origin policies can silently drop cross-origin font fetches —
|
|
66
|
+
* inlining keeps the icons resolvable purely from same-origin
|
|
67
|
+
* resources. Hosts typically gather this string by scraping
|
|
68
|
+
* `document.styleSheets` for `@font-face` rules whose family starts
|
|
69
|
+
* with `"Font Awesome"`. A CDN `<link>` is emitted only when this option
|
|
70
|
+
* is absent and {@link externalResources} is explicitly `allow`.
|
|
71
|
+
*/
|
|
72
|
+
iconsCss?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Whether this exporter may add remote font/icon stylesheets. Defaults to
|
|
75
|
+
* `deny`, keeping the generated file self-contained. Authored links and
|
|
76
|
+
* images are unaffected; bundle exporters are responsible for inlining or
|
|
77
|
+
* rewriting those document resources.
|
|
78
|
+
*/
|
|
79
|
+
externalResources?: 'deny' | 'allow';
|
|
80
|
+
/**
|
|
81
|
+
* Raw HTML policy. Defaults to `sanitize`, which removes unsafe tags,
|
|
82
|
+
* event handlers, and executable URL schemes before emitting HTML.
|
|
83
|
+
*/
|
|
84
|
+
htmlPolicy?: HtmlPolicy;
|
|
85
|
+
/**
|
|
86
|
+
* How a hosted video (a paragraph that is only a link to a YouTube, Vimeo,
|
|
87
|
+
* Loom or Wistia page, or that provider's `<iframe>` embed
|
|
88
|
+
* code) renders:
|
|
89
|
+
*
|
|
90
|
+
* - `player` (default) — the provider's player iframe;
|
|
91
|
+
* - `poster` — a static card linking to the video's page (the provider's
|
|
92
|
+
* thumbnail where it serves one). For contexts where a player cannot run:
|
|
93
|
+
* a preview iframe sandboxed without `allow-scripts` (nested frames
|
|
94
|
+
* inherit the sandbox, so the player would load broken), or print.
|
|
95
|
+
*/
|
|
96
|
+
videoEmbeds?: 'player' | 'poster';
|
|
97
|
+
/**
|
|
98
|
+
* Inline icons as SVG, keyed `family:name` (`solid:star`) — the `icons` that
|
|
99
|
+
* `prepareMarkdownDocForPlainHtml` (`@bendyline/squisq-formats/html-prepare`)
|
|
100
|
+
* returns when given `outlineIcons`, or `plainHtmlIcons` from
|
|
101
|
+
* `@bendyline/squisq-formats/html-icons` called directly. An icon found here
|
|
102
|
+
* is drawn as an inline `<svg>` in the text color and needs no Font Awesome
|
|
103
|
+
* stylesheet; any other icon keeps its Font Awesome markup (see
|
|
104
|
+
* {@link iconsCss}).
|
|
105
|
+
*/
|
|
106
|
+
icons?: ReadonlyMap<string, PlainHtmlIcon>;
|
|
107
|
+
}
|
|
108
|
+
/** One icon's outline: an SVG path in a `0 0 width height` box whose height is 1em. */
|
|
109
|
+
interface PlainHtmlIcon {
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
path: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Render a parsed markdown document as a complete, semantic HTML page.
|
|
116
|
+
*
|
|
117
|
+
* When `options.theme` is provided, the output adopts the theme's
|
|
118
|
+
* colors and typography. Google-hosted fonts referenced by the theme
|
|
119
|
+
* are loaded via a single `<link>` to fonts.googleapis.com so the page
|
|
120
|
+
* renders consistently when opened standalone.
|
|
121
|
+
*/
|
|
122
|
+
declare function markdownDocToPlainHtml(doc: MarkdownDocument, options?: PlainHtmlExportOptions): string;
|
|
123
|
+
/**
|
|
124
|
+
* The pieces of a plain HTML page that belong to the document itself, for a
|
|
125
|
+
* host that places the document inside a page of its own (see
|
|
126
|
+
* `applyHtmlPageTemplate`).
|
|
127
|
+
*/
|
|
128
|
+
interface PlainHtmlParts {
|
|
129
|
+
/** The `title` option, unescaped. */
|
|
130
|
+
title: string;
|
|
131
|
+
/** The rendered document body, footnotes included. */
|
|
132
|
+
bodyHtml: string;
|
|
133
|
+
/**
|
|
134
|
+
* `<head>` markup for the CSS the body's own constructs need — feature
|
|
135
|
+
* sections, video embeds, SVG islands, icons — and nothing that styles the
|
|
136
|
+
* page around them: no theme typography, colors, fonts, or `body` rules.
|
|
137
|
+
*/
|
|
138
|
+
featureHeadHtml: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Render a document's body and the functional CSS it depends on, without the
|
|
142
|
+
* page shell or theme stylesheet `markdownDocToPlainHtml` wraps around them.
|
|
143
|
+
* The theme (when one resolves) still informs body rendering, such as the
|
|
144
|
+
* color an SVG island's `currentColor` follows.
|
|
145
|
+
*/
|
|
146
|
+
declare function markdownDocToPlainHtmlParts(doc: MarkdownDocument, options?: PlainHtmlExportOptions): PlainHtmlParts;
|
|
147
|
+
|
|
148
|
+
export { type PlainHtmlIcon as P, type PlainHtmlExportOptions as a, type PlainHtmlParts as b, markdownDocToPlainHtmlParts as c, markdownDocToPlainHtml as m };
|
package/dist/pptx/index.js
CHANGED
package/dist/registry/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-formats",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.11",
|
|
4
4
|
"description": "Document format converters — DOCX, PDF, OOXML import/export",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -83,6 +83,16 @@
|
|
|
83
83
|
"import": "./dist/html/index.js",
|
|
84
84
|
"default": "./dist/html/index.js"
|
|
85
85
|
},
|
|
86
|
+
"./html-icons": {
|
|
87
|
+
"types": "./dist/html/icons.d.ts",
|
|
88
|
+
"import": "./dist/html/icons.js",
|
|
89
|
+
"default": "./dist/html/icons.js"
|
|
90
|
+
},
|
|
91
|
+
"./html-prepare": {
|
|
92
|
+
"types": "./dist/html/prepare.d.ts",
|
|
93
|
+
"import": "./dist/html/prepare.js",
|
|
94
|
+
"default": "./dist/html/prepare.js"
|
|
95
|
+
},
|
|
86
96
|
"./epub": {
|
|
87
97
|
"types": "./dist/epub/index.d.ts",
|
|
88
98
|
"import": "./dist/epub/index.js",
|
|
@@ -125,7 +135,7 @@
|
|
|
125
135
|
"typecheck": "tsc --noEmit"
|
|
126
136
|
},
|
|
127
137
|
"dependencies": {
|
|
128
|
-
"@bendyline/squisq": "2.13.
|
|
138
|
+
"@bendyline/squisq": "2.13.9",
|
|
129
139
|
"@pdf-lib/fontkit": "1.1.1",
|
|
130
140
|
"@pdf-lib/upng": "1.0.1",
|
|
131
141
|
"@xmldom/xmldom": "0.9.12",
|
|
File without changes
|
|
File without changes
|