documents.js 4.3.0 → 4.4.1
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 +5 -5
- package/dist/convert/composition.cjs +4 -1
- package/dist/convert/composition.js +4 -1
- package/dist/convert/pdf-package-tables.cjs +76 -0
- package/dist/convert/pdf-package-tables.d.cts +6 -0
- package/dist/convert/pdf-package-tables.d.ts +6 -0
- package/dist/convert/pdf-package-tables.js +75 -0
- package/dist/edit/pdf/item.cjs +42 -1
- package/dist/edit/pdf/item.d.cts +2 -2
- package/dist/edit/pdf/item.d.ts +2 -2
- package/dist/edit/pdf/item.js +42 -2
- package/dist/edit/pdf/page.d.cts +1 -1
- package/dist/edit/pdf/page.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{item-D9vQKT0T.d.cts → item-DhXpJNAQ.d.cts} +17 -3
- package/dist/{item-D9vQKT0T.d.ts → item-DhXpJNAQ.d.ts} +17 -3
- package/dist/layout/reconstruct.cjs +135 -6
- package/dist/layout/reconstruct.js +135 -6
- package/dist/markdown/math.cjs +5 -7
- package/dist/markdown/math.js +5 -7
- package/dist/markdown/write.cjs +0 -10
- package/dist/markdown/write.d.cts +2 -6
- package/dist/markdown/write.d.ts +2 -6
- package/dist/markdown/write.js +1 -10
- package/package.json +6 -6
package/dist/markdown/math.js
CHANGED
|
@@ -2,7 +2,6 @@ import { buildFormulaBlock } from "../model/formula.js";
|
|
|
2
2
|
import { extractSymbolDefinitionsFromProse } from "../latex/symbols.js";
|
|
3
3
|
import { latexToFormula } from "../latex/lower.js";
|
|
4
4
|
//#region src/markdown/math.ts
|
|
5
|
-
const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
6
5
|
const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
7
6
|
const STAND_IN_FRAME = {
|
|
8
7
|
xPt: 0,
|
|
@@ -61,14 +60,13 @@ function lowerMarkdownMath(document, options) {
|
|
|
61
60
|
});
|
|
62
61
|
continue;
|
|
63
62
|
}
|
|
64
|
-
if (block.kind
|
|
65
|
-
|
|
63
|
+
if (block.kind === "embeddedObject" && block.objectKind === "formula" && block.document.kind === "formula" && block.document.formula.presentation !== void 0) {
|
|
64
|
+
const formulaBlock = lowerOne(block.document.formula.presentation.latex, MATH_BLOCK_SOURCE);
|
|
65
|
+
out.push(formulaBlock ?? block);
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
|
-
if (block.
|
|
69
|
-
|
|
70
|
-
const formulaBlock = lowerOne(latex, MATH_BLOCK_SOURCE);
|
|
71
|
-
out.push(formulaBlock ?? block);
|
|
68
|
+
if (block.kind !== "paragraph") {
|
|
69
|
+
out.push(block);
|
|
72
70
|
continue;
|
|
73
71
|
}
|
|
74
72
|
const extraction = extractInlineMath(block.runs);
|
package/dist/markdown/write.cjs
CHANGED
|
@@ -2,14 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_model_formula = require("../model/formula.cjs");
|
|
3
3
|
let markdown_codec = require("markdown-codec");
|
|
4
4
|
//#region src/markdown/write.ts
|
|
5
|
-
var MarkdownConstructUnsupportedError = class extends Error {
|
|
6
|
-
descriptorKind;
|
|
7
|
-
constructor(block) {
|
|
8
|
-
super(block.kind === "constructStart" ? `buildMarkdownText: a construct marker (descriptor kind '${block.descriptor.kind}') has no CommonMark/GFM representation -- markdown-codec's own writer has no arm for the constructStart/constructEnd block kinds` : `buildMarkdownText: a construct marker has no CommonMark/GFM representation -- markdown-codec's own writer has no arm for the constructStart/constructEnd block kinds`);
|
|
9
|
-
this.name = "MarkdownConstructUnsupportedError";
|
|
10
|
-
this.descriptorKind = block.kind === "constructStart" ? block.descriptor.kind : void 0;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
5
|
const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
14
6
|
const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
15
7
|
const MATH_INLINE_SOURCE = "markdown:math-inline";
|
|
@@ -34,7 +26,6 @@ function formulaParagraph(formula) {
|
|
|
34
26
|
};
|
|
35
27
|
}
|
|
36
28
|
function markdownBlock(block) {
|
|
37
|
-
if (block.kind === "constructStart" || block.kind === "constructEnd") throw new MarkdownConstructUnsupportedError(block);
|
|
38
29
|
if (block.kind === "pageBreak") return {
|
|
39
30
|
kind: "paragraph",
|
|
40
31
|
runs: [{ text: PAGE_BREAK_MARKER }],
|
|
@@ -72,6 +63,5 @@ function buildMarkdownText(document, options) {
|
|
|
72
63
|
}, options);
|
|
73
64
|
}
|
|
74
65
|
//#endregion
|
|
75
|
-
exports.MarkdownConstructUnsupportedError = MarkdownConstructUnsupportedError;
|
|
76
66
|
exports.PAGE_BREAK_MARKER = PAGE_BREAK_MARKER;
|
|
77
67
|
exports.buildMarkdownText = buildMarkdownText;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContentDocument } from "document-schema.js";
|
|
2
2
|
import { WriteMarkdownOptions } from "markdown-codec";
|
|
3
3
|
//#region src/markdown/write.d.ts
|
|
4
|
-
declare class MarkdownConstructUnsupportedError extends Error {
|
|
5
|
-
readonly descriptorKind: ContentConstructStart['descriptor']['kind'] | undefined;
|
|
6
|
-
constructor(block: ContentConstructStart | ContentConstructEnd);
|
|
7
|
-
}
|
|
8
4
|
declare const PAGE_BREAK_MARKER = "<!-- page break -->";
|
|
9
5
|
declare function buildMarkdownText(document: ContentDocument, options?: WriteMarkdownOptions): string;
|
|
10
6
|
//#endregion
|
|
11
|
-
export {
|
|
7
|
+
export { PAGE_BREAK_MARKER, buildMarkdownText };
|
package/dist/markdown/write.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContentDocument } from "document-schema.js";
|
|
2
2
|
import { WriteMarkdownOptions } from "markdown-codec";
|
|
3
3
|
//#region src/markdown/write.d.ts
|
|
4
|
-
declare class MarkdownConstructUnsupportedError extends Error {
|
|
5
|
-
readonly descriptorKind: ContentConstructStart['descriptor']['kind'] | undefined;
|
|
6
|
-
constructor(block: ContentConstructStart | ContentConstructEnd);
|
|
7
|
-
}
|
|
8
4
|
declare const PAGE_BREAK_MARKER = "<!-- page break -->";
|
|
9
5
|
declare function buildMarkdownText(document: ContentDocument, options?: WriteMarkdownOptions): string;
|
|
10
6
|
//#endregion
|
|
11
|
-
export {
|
|
7
|
+
export { PAGE_BREAK_MARKER, buildMarkdownText };
|
package/dist/markdown/write.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { formulaOfBlock, formulaPlaceholderText } from "../model/formula.js";
|
|
2
2
|
import { HTML_PREFORMATTED_STYLE_ID, MarkdownUnsupportedDocumentKindError, writeMarkdownContent } from "markdown-codec";
|
|
3
3
|
//#region src/markdown/write.ts
|
|
4
|
-
var MarkdownConstructUnsupportedError = class extends Error {
|
|
5
|
-
descriptorKind;
|
|
6
|
-
constructor(block) {
|
|
7
|
-
super(block.kind === "constructStart" ? `buildMarkdownText: a construct marker (descriptor kind '${block.descriptor.kind}') has no CommonMark/GFM representation -- markdown-codec's own writer has no arm for the constructStart/constructEnd block kinds` : `buildMarkdownText: a construct marker has no CommonMark/GFM representation -- markdown-codec's own writer has no arm for the constructStart/constructEnd block kinds`);
|
|
8
|
-
this.name = "MarkdownConstructUnsupportedError";
|
|
9
|
-
this.descriptorKind = block.kind === "constructStart" ? block.descriptor.kind : void 0;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
4
|
const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
13
5
|
const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
14
6
|
const MATH_INLINE_SOURCE = "markdown:math-inline";
|
|
@@ -33,7 +25,6 @@ function formulaParagraph(formula) {
|
|
|
33
25
|
};
|
|
34
26
|
}
|
|
35
27
|
function markdownBlock(block) {
|
|
36
|
-
if (block.kind === "constructStart" || block.kind === "constructEnd") throw new MarkdownConstructUnsupportedError(block);
|
|
37
28
|
if (block.kind === "pageBreak") return {
|
|
38
29
|
kind: "paragraph",
|
|
39
30
|
runs: [{ text: PAGE_BREAK_MARKER }],
|
|
@@ -71,4 +62,4 @@ function buildMarkdownText(document, options) {
|
|
|
71
62
|
}, options);
|
|
72
63
|
}
|
|
73
64
|
//#endregion
|
|
74
|
-
export {
|
|
65
|
+
export { PAGE_BREAK_MARKER, buildMarkdownText };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "documents.js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -101,12 +101,12 @@
|
|
|
101
101
|
"packageManager": "pnpm@11.6.0",
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"byte-codec": "^1.1.13",
|
|
104
|
-
"document-schema.js": "^4.
|
|
104
|
+
"document-schema.js": "^4.8.0",
|
|
105
105
|
"fflate": "^0.8.3",
|
|
106
|
-
"markdown-codec": "^4.0
|
|
107
|
-
"odf.js": "^5.1.
|
|
108
|
-
"ooxml.js": "^4.4.
|
|
109
|
-
"pdf-codec": "^3.
|
|
106
|
+
"markdown-codec": "^4.1.0",
|
|
107
|
+
"odf.js": "^5.1.2",
|
|
108
|
+
"ooxml.js": "^4.4.3",
|
|
109
|
+
"pdf-codec": "^3.2.0",
|
|
110
110
|
"temml": "0.13.4",
|
|
111
111
|
"zod": "^4.4.3"
|
|
112
112
|
},
|