@drghaliasri/butex 6.1.4 → 7.0.0
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 +41 -12
- package/dist/document.js +21 -4
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +21 -4
- package/dist/document.mjs.map +1 -1
- package/dist/document2-cli.js +21 -4
- package/dist/document2-cli.js.map +1 -1
- package/dist/document2.d.mts +34 -2
- package/dist/document2.d.ts +34 -2
- package/dist/document2.js +343 -20
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +334 -15
- package/dist/document2.mjs.map +1 -1
- package/dist/index.global.js +104 -6
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +104 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -6
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +2066 -599
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +2064 -596
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +22 -7
- package/dist/react-document2.d.ts +22 -7
- package/dist/react-document2.js +4019 -1088
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +4000 -1068
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +9 -2
- package/dist/react.d.ts +9 -2
- package/dist/react.js +1954 -507
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1955 -507
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document2.mjs
CHANGED
|
@@ -913,14 +913,22 @@ function labelNumberMap(document2) {
|
|
|
913
913
|
}
|
|
914
914
|
return map;
|
|
915
915
|
}
|
|
916
|
+
function labelKindWord(kind, uiLocale) {
|
|
917
|
+
if (kind === "fig") {
|
|
918
|
+
return uiLocale === "ar" ? "\u0627\u0644\u0634\u0643\u0644" : "Figure";
|
|
919
|
+
}
|
|
920
|
+
if (kind === "tab") {
|
|
921
|
+
return uiLocale === "ar" ? "\u0627\u0644\u062C\u062F\u0648\u0644" : "Table";
|
|
922
|
+
}
|
|
923
|
+
return uiLocale === "ar" ? "\u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" : "Equation";
|
|
924
|
+
}
|
|
916
925
|
function formatFloatCaptionTitle(kind, number, options = {}) {
|
|
917
926
|
const locale = options.uiLocale ?? "ar";
|
|
918
|
-
const kindWord = kind === "fig" ? locale === "ar" ? "\u0627\u0644\u0634\u0643\u0644" : "Figure" : kind === "tab" ? locale === "ar" ? "\u0627\u0644\u062C\u062F\u0648\u0644" : "Table" : locale === "ar" ? "\u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" : "Equation";
|
|
919
927
|
const digits = formatBibliographyNumber(number, {
|
|
920
928
|
documentDirection: options.documentDirection ?? (locale === "ar" ? "rtl" : "ltr"),
|
|
921
929
|
digitForm: options.digitForm ?? (locale === "ar" ? "arabicIndic" : "western")
|
|
922
930
|
});
|
|
923
|
-
return `${
|
|
931
|
+
return `${labelKindWord(kind, locale)} ${digits}`;
|
|
924
932
|
}
|
|
925
933
|
function formatFloatCaptionPreview(title, caption, uiLocale = "ar") {
|
|
926
934
|
const trimmed = caption?.trim() ?? "";
|
|
@@ -933,19 +941,18 @@ function formatFloatCaptionPreview(title, caption, uiLocale = "ar") {
|
|
|
933
941
|
function formatRefLabel(keys, document2, refCommand, options = {}) {
|
|
934
942
|
const documentDirection = options.documentDirection ?? "rtl";
|
|
935
943
|
const digitForm = options.digitForm ?? (documentDirection === "rtl" ? "arabicIndic" : "western");
|
|
944
|
+
const uiLocale = documentDirection === "rtl" ? "ar" : "en";
|
|
936
945
|
const map = labelNumberMap(document2);
|
|
937
946
|
const parts = keys.map((key) => {
|
|
938
947
|
const hit = map.get(key);
|
|
939
948
|
if (!hit) {
|
|
940
|
-
return "?";
|
|
949
|
+
return refCommand === "eqref" ? "(?)" : "?";
|
|
941
950
|
}
|
|
942
|
-
|
|
951
|
+
const digits = formatDigits(String(hit.number), digitForm);
|
|
952
|
+
const numberLabel = refCommand === "eqref" ? `(${digits})` : digits;
|
|
953
|
+
return `${labelKindWord(hit.kind, uiLocale)} ${numberLabel}`;
|
|
943
954
|
});
|
|
944
|
-
|
|
945
|
-
if (refCommand === "eqref") {
|
|
946
|
-
return `(${body})`;
|
|
947
|
-
}
|
|
948
|
-
return body;
|
|
955
|
+
return parts.join(documentDirection === "rtl" ? "\u060C" : ", ");
|
|
949
956
|
}
|
|
950
957
|
function stripDisplayMathDelimiters(source) {
|
|
951
958
|
const trimmed = source.trim();
|
|
@@ -3731,14 +3738,20 @@ var BUTEX_EDITOR_CSS = `
|
|
|
3731
3738
|
${BUTEX_FONT_FACE_CSS}
|
|
3732
3739
|
|
|
3733
3740
|
.surface {
|
|
3741
|
+
background: var(--butex-surface-bg, linear-gradient(180deg, #ffffff 0%, #fafbfc 100%));
|
|
3734
3742
|
border: 1px solid var(--butex-border, #e2e8f0);
|
|
3735
3743
|
border-radius: 12px;
|
|
3736
|
-
min-height: 100px;
|
|
3737
|
-
padding: 8px 10px;
|
|
3738
|
-
background: var(--butex-surface-bg, linear-gradient(180deg, #ffffff 0%, #fafbfc 100%));
|
|
3739
3744
|
color: var(--butex-surface-fg, #0f172a);
|
|
3740
|
-
outline: none;
|
|
3741
3745
|
cursor: text;
|
|
3746
|
+
max-width: 100%;
|
|
3747
|
+
min-height: 100px;
|
|
3748
|
+
min-width: 0;
|
|
3749
|
+
outline: none;
|
|
3750
|
+
overflow-x: auto;
|
|
3751
|
+
overflow-y: hidden;
|
|
3752
|
+
overscroll-behavior-inline: contain;
|
|
3753
|
+
padding: 8px 10px;
|
|
3754
|
+
touch-action: pan-x pan-y;
|
|
3742
3755
|
transition: box-shadow 0.15s ease, border-color 0.15s ease;
|
|
3743
3756
|
}
|
|
3744
3757
|
|
|
@@ -3803,6 +3816,17 @@ ${CHARACTER_FONT_CSS}
|
|
|
3803
3816
|
50% { opacity: 0; }
|
|
3804
3817
|
}
|
|
3805
3818
|
|
|
3819
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3820
|
+
.surface {
|
|
3821
|
+
scroll-behavior: auto;
|
|
3822
|
+
transition: none;
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
.caret {
|
|
3826
|
+
animation: none;
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3806
3830
|
.node {
|
|
3807
3831
|
display: inline-flex;
|
|
3808
3832
|
align-items: stretch;
|
|
@@ -7100,6 +7124,287 @@ ${body}
|
|
|
7100
7124
|
`;
|
|
7101
7125
|
}
|
|
7102
7126
|
|
|
7127
|
+
// src/document2/validation.ts
|
|
7128
|
+
var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
7129
|
+
function hasXeLatexUnsupportedEmoji(value) {
|
|
7130
|
+
return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
|
|
7131
|
+
}
|
|
7132
|
+
function addIssue(context, code, path, blockId, tokenId) {
|
|
7133
|
+
context.issues.push({
|
|
7134
|
+
code,
|
|
7135
|
+
path,
|
|
7136
|
+
...blockId ? { blockId } : {},
|
|
7137
|
+
...tokenId ? { tokenId } : {}
|
|
7138
|
+
});
|
|
7139
|
+
}
|
|
7140
|
+
function validateTextValue(context, value, path, blockId, tokenId) {
|
|
7141
|
+
if (hasXeLatexUnsupportedEmoji(value)) {
|
|
7142
|
+
addIssue(context, "unsupported_emoji", path, blockId, tokenId);
|
|
7143
|
+
}
|
|
7144
|
+
}
|
|
7145
|
+
function registerKey(context, key, path, kind, blockId, tokenId) {
|
|
7146
|
+
const normalized = normalizeDocument2Key(key);
|
|
7147
|
+
if (normalized.length === 0) {
|
|
7148
|
+
addIssue(context, "key_empty", path, blockId, tokenId);
|
|
7149
|
+
return;
|
|
7150
|
+
}
|
|
7151
|
+
if (!isValidDocument2Key(normalized)) {
|
|
7152
|
+
addIssue(context, "key_invalid", path, blockId, tokenId);
|
|
7153
|
+
return;
|
|
7154
|
+
}
|
|
7155
|
+
context.keyOwners.push({
|
|
7156
|
+
key: normalized,
|
|
7157
|
+
path,
|
|
7158
|
+
kind,
|
|
7159
|
+
...blockId ? { blockId } : {},
|
|
7160
|
+
...tokenId ? { tokenId } : {}
|
|
7161
|
+
});
|
|
7162
|
+
if (kind !== "reference" && !context.labelKinds.has(normalized)) {
|
|
7163
|
+
context.labelKinds.set(normalized, kind);
|
|
7164
|
+
}
|
|
7165
|
+
}
|
|
7166
|
+
function validateToken(context, token, path, blockId) {
|
|
7167
|
+
if (token.kind === "text") {
|
|
7168
|
+
validateTextValue(context, token.text, `${path}.text`, blockId, token.id);
|
|
7169
|
+
return;
|
|
7170
|
+
}
|
|
7171
|
+
if (token.kind === "cite") {
|
|
7172
|
+
if (token.keys.length === 0) {
|
|
7173
|
+
addIssue(context, "empty_citation", `${path}.keys`, blockId, token.id);
|
|
7174
|
+
}
|
|
7175
|
+
context.pendingCitations.push({ token, path, blockId });
|
|
7176
|
+
return;
|
|
7177
|
+
}
|
|
7178
|
+
if (token.kind === "ref") {
|
|
7179
|
+
if (token.keys.length === 0) {
|
|
7180
|
+
addIssue(context, "empty_reference", `${path}.keys`, blockId, token.id);
|
|
7181
|
+
}
|
|
7182
|
+
context.pendingReferences.push({ token, path, blockId });
|
|
7183
|
+
return;
|
|
7184
|
+
}
|
|
7185
|
+
validateTextValue(context, token.source, `${path}.source`, blockId, token.id);
|
|
7186
|
+
if (!token.labelEnabled) {
|
|
7187
|
+
return;
|
|
7188
|
+
}
|
|
7189
|
+
if (!token.display) {
|
|
7190
|
+
addIssue(context, "invalid_equation_label", `${path}.label`, blockId, token.id);
|
|
7191
|
+
return;
|
|
7192
|
+
}
|
|
7193
|
+
registerKey(context, token.label ?? "", `${path}.label`, "eq", blockId, token.id);
|
|
7194
|
+
}
|
|
7195
|
+
function validateInlineField(context, field, path, blockId) {
|
|
7196
|
+
field.tokens.forEach((token, index) => {
|
|
7197
|
+
validateToken(context, token, `${path}.tokens[${String(index)}]`, blockId);
|
|
7198
|
+
});
|
|
7199
|
+
}
|
|
7200
|
+
function validateBlock(context, block, path) {
|
|
7201
|
+
if (block.kind === "textBlock") {
|
|
7202
|
+
validateInlineField(context, block.field, `${path}.field`, block.id);
|
|
7203
|
+
return;
|
|
7204
|
+
}
|
|
7205
|
+
if (block.kind === "list") {
|
|
7206
|
+
block.items.forEach((item, itemIndex) => {
|
|
7207
|
+
const itemPath = `${path}.items[${String(itemIndex)}]`;
|
|
7208
|
+
validateInlineField(context, item.field, `${itemPath}.field`, block.id);
|
|
7209
|
+
item.blocks.forEach((child, childIndex) => {
|
|
7210
|
+
validateBlock(context, child, `${itemPath}.blocks[${String(childIndex)}]`);
|
|
7211
|
+
});
|
|
7212
|
+
});
|
|
7213
|
+
return;
|
|
7214
|
+
}
|
|
7215
|
+
if (block.kind === "table") {
|
|
7216
|
+
if (block.columns.trim().length === 0 || block.rows.length === 0) {
|
|
7217
|
+
addIssue(context, "invalid_table", path, block.id);
|
|
7218
|
+
}
|
|
7219
|
+
const expectedColumns = block.rows[0]?.length ?? 0;
|
|
7220
|
+
if (expectedColumns === 0 || block.rows.some((row) => row.length !== expectedColumns)) {
|
|
7221
|
+
addIssue(context, "invalid_table", `${path}.rows`, block.id);
|
|
7222
|
+
}
|
|
7223
|
+
block.rows.forEach((row, rowIndex) => {
|
|
7224
|
+
row.forEach((cell, columnIndex) => {
|
|
7225
|
+
validateInlineField(
|
|
7226
|
+
context,
|
|
7227
|
+
cell,
|
|
7228
|
+
`${path}.rows[${String(rowIndex)}][${String(columnIndex)}]`,
|
|
7229
|
+
block.id
|
|
7230
|
+
);
|
|
7231
|
+
});
|
|
7232
|
+
});
|
|
7233
|
+
validateTextValue(context, block.caption, `${path}.caption`, block.id);
|
|
7234
|
+
if (block.labelEnabled) {
|
|
7235
|
+
registerKey(context, block.label, `${path}.label`, "tab", block.id);
|
|
7236
|
+
}
|
|
7237
|
+
return;
|
|
7238
|
+
}
|
|
7239
|
+
if (block.kind === "image") {
|
|
7240
|
+
const hasAssetId = typeof block.assetId === "string" && block.assetId.trim().length > 0;
|
|
7241
|
+
const hasValue = block.value.trim().length > 0;
|
|
7242
|
+
if (!hasAssetId && !hasValue) {
|
|
7243
|
+
addIssue(context, "empty_image", path, block.id);
|
|
7244
|
+
}
|
|
7245
|
+
validateTextValue(context, block.value, `${path}.value`, block.id);
|
|
7246
|
+
validateTextValue(context, block.caption, `${path}.caption`, block.id);
|
|
7247
|
+
if (block.labelEnabled) {
|
|
7248
|
+
registerKey(context, block.label, `${path}.label`, "fig", block.id);
|
|
7249
|
+
}
|
|
7250
|
+
return;
|
|
7251
|
+
}
|
|
7252
|
+
if (block.kind === "raw") {
|
|
7253
|
+
validateTextValue(context, block.value, `${path}.value`, block.id);
|
|
7254
|
+
}
|
|
7255
|
+
}
|
|
7256
|
+
function validateDuplicateKeys(context) {
|
|
7257
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
7258
|
+
for (const owner of context.keyOwners) {
|
|
7259
|
+
const group = grouped.get(owner.key) ?? [];
|
|
7260
|
+
group.push(owner);
|
|
7261
|
+
grouped.set(owner.key, group);
|
|
7262
|
+
}
|
|
7263
|
+
for (const owners of grouped.values()) {
|
|
7264
|
+
if (owners.length < 2) {
|
|
7265
|
+
continue;
|
|
7266
|
+
}
|
|
7267
|
+
for (const owner of owners) {
|
|
7268
|
+
addIssue(context, "key_duplicate", owner.path, owner.blockId, owner.tokenId);
|
|
7269
|
+
}
|
|
7270
|
+
}
|
|
7271
|
+
}
|
|
7272
|
+
function validatePendingReferences(context) {
|
|
7273
|
+
for (const pending of context.pendingCitations) {
|
|
7274
|
+
if (pending.token.keys.some((key) => !isValidDocument2Key(normalizeDocument2Key(key)))) {
|
|
7275
|
+
addIssue(
|
|
7276
|
+
context,
|
|
7277
|
+
"missing_citation",
|
|
7278
|
+
`${pending.path}.keys`,
|
|
7279
|
+
pending.blockId,
|
|
7280
|
+
pending.token.id
|
|
7281
|
+
);
|
|
7282
|
+
}
|
|
7283
|
+
}
|
|
7284
|
+
for (const pending of context.pendingReferences) {
|
|
7285
|
+
for (const key of pending.token.keys) {
|
|
7286
|
+
const normalized = normalizeDocument2Key(key);
|
|
7287
|
+
if (!isValidDocument2Key(normalized)) {
|
|
7288
|
+
addIssue(
|
|
7289
|
+
context,
|
|
7290
|
+
"missing_reference",
|
|
7291
|
+
`${pending.path}.keys`,
|
|
7292
|
+
pending.blockId,
|
|
7293
|
+
pending.token.id
|
|
7294
|
+
);
|
|
7295
|
+
break;
|
|
7296
|
+
}
|
|
7297
|
+
const kind = context.labelKinds.get(normalized);
|
|
7298
|
+
if (kind && pending.token.refCommand === "eqref" !== (kind === "eq")) {
|
|
7299
|
+
addIssue(
|
|
7300
|
+
context,
|
|
7301
|
+
"reference_kind_mismatch",
|
|
7302
|
+
`${pending.path}.keys`,
|
|
7303
|
+
pending.blockId,
|
|
7304
|
+
pending.token.id
|
|
7305
|
+
);
|
|
7306
|
+
break;
|
|
7307
|
+
}
|
|
7308
|
+
}
|
|
7309
|
+
}
|
|
7310
|
+
}
|
|
7311
|
+
function isRecord(value) {
|
|
7312
|
+
return typeof value === "object" && value !== null;
|
|
7313
|
+
}
|
|
7314
|
+
function hasRuntimeDocumentShape(document2) {
|
|
7315
|
+
const value = document2;
|
|
7316
|
+
return isRecord(value) && value.nodeType === "DocumentObject";
|
|
7317
|
+
}
|
|
7318
|
+
function hasWireDocumentShape(document2) {
|
|
7319
|
+
const value = document2;
|
|
7320
|
+
if (!isRecord(value) || value.node_type !== "DocumentObject" || !Array.isArray(value.blocks)) {
|
|
7321
|
+
return false;
|
|
7322
|
+
}
|
|
7323
|
+
if (value.meta !== void 0 && !isRecord(value.meta)) {
|
|
7324
|
+
return false;
|
|
7325
|
+
}
|
|
7326
|
+
if (value.references !== void 0) {
|
|
7327
|
+
if (!Array.isArray(value.references)) {
|
|
7328
|
+
return false;
|
|
7329
|
+
}
|
|
7330
|
+
for (const reference of value.references) {
|
|
7331
|
+
if (!isRecord(reference) || typeof reference.key !== "string" || reference.key.trim().length === 0) {
|
|
7332
|
+
return false;
|
|
7333
|
+
}
|
|
7334
|
+
}
|
|
7335
|
+
}
|
|
7336
|
+
return true;
|
|
7337
|
+
}
|
|
7338
|
+
function resolveDocument(document2) {
|
|
7339
|
+
if (hasRuntimeDocumentShape(document2)) {
|
|
7340
|
+
try {
|
|
7341
|
+
toDocumentJson2(document2);
|
|
7342
|
+
return document2;
|
|
7343
|
+
} catch {
|
|
7344
|
+
return null;
|
|
7345
|
+
}
|
|
7346
|
+
}
|
|
7347
|
+
if (!hasWireDocumentShape(document2)) {
|
|
7348
|
+
return null;
|
|
7349
|
+
}
|
|
7350
|
+
try {
|
|
7351
|
+
return fromDocumentJson2(document2);
|
|
7352
|
+
} catch {
|
|
7353
|
+
return null;
|
|
7354
|
+
}
|
|
7355
|
+
}
|
|
7356
|
+
function validateDocument2(document2) {
|
|
7357
|
+
const resolved = resolveDocument(document2);
|
|
7358
|
+
if (!resolved) {
|
|
7359
|
+
return {
|
|
7360
|
+
valid: false,
|
|
7361
|
+
issues: [{ code: "malformed_document", path: "$" }]
|
|
7362
|
+
};
|
|
7363
|
+
}
|
|
7364
|
+
const context = {
|
|
7365
|
+
issues: [],
|
|
7366
|
+
keyOwners: [],
|
|
7367
|
+
labelKinds: /* @__PURE__ */ new Map(),
|
|
7368
|
+
pendingCitations: [],
|
|
7369
|
+
pendingReferences: []
|
|
7370
|
+
};
|
|
7371
|
+
validateTextValue(context, resolved.meta.title, "$.meta.title");
|
|
7372
|
+
validateTextValue(context, resolved.meta.authors, "$.meta.authors");
|
|
7373
|
+
validateTextValue(context, resolved.meta.abstract, "$.meta.abstract");
|
|
7374
|
+
resolved.references.forEach((reference, index) => {
|
|
7375
|
+
const path = `$.references[${String(index)}]`;
|
|
7376
|
+
registerKey(context, reference.key, `${path}.key`, "reference");
|
|
7377
|
+
validateTextValue(context, reference.authors, `${path}.authors`);
|
|
7378
|
+
validateTextValue(context, reference.title, `${path}.title`);
|
|
7379
|
+
validateTextValue(context, reference.year, `${path}.year`);
|
|
7380
|
+
validateTextValue(context, reference.url, `${path}.url`);
|
|
7381
|
+
validateTextValue(context, reference.venue, `${path}.venue`);
|
|
7382
|
+
});
|
|
7383
|
+
resolved.blocks.forEach((block, index) => {
|
|
7384
|
+
validateBlock(context, block, `$.blocks[${String(index)}]`);
|
|
7385
|
+
});
|
|
7386
|
+
for (const diagnostic of resolved.diagnostics) {
|
|
7387
|
+
addIssue(context, "parser_diagnostic", diagnostic.path);
|
|
7388
|
+
}
|
|
7389
|
+
validateDuplicateKeys(context);
|
|
7390
|
+
validatePendingReferences(context);
|
|
7391
|
+
return {
|
|
7392
|
+
valid: context.issues.length === 0,
|
|
7393
|
+
issues: context.issues
|
|
7394
|
+
};
|
|
7395
|
+
}
|
|
7396
|
+
function isDocument2Valid(document2) {
|
|
7397
|
+
return validateDocument2(document2).valid;
|
|
7398
|
+
}
|
|
7399
|
+
var Document2ValidationError = class extends Error {
|
|
7400
|
+
issues;
|
|
7401
|
+
constructor(issues) {
|
|
7402
|
+
super("Document2 validation failed; invalid drafts cannot be exported to LaTeX.");
|
|
7403
|
+
this.name = "Document2ValidationError";
|
|
7404
|
+
this.issues = issues;
|
|
7405
|
+
}
|
|
7406
|
+
};
|
|
7407
|
+
|
|
7103
7408
|
// src/document2/history.ts
|
|
7104
7409
|
var DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH = 100;
|
|
7105
7410
|
function createDocument2History(maxDepth = DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH) {
|
|
@@ -7307,6 +7612,7 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
7307
7612
|
src: block.value,
|
|
7308
7613
|
...block.assetId !== void 0 ? { assetId: block.assetId } : {},
|
|
7309
7614
|
options: block.options,
|
|
7615
|
+
centered: block.centered,
|
|
7310
7616
|
...block.captionEnabled && block.caption.trim().length > 0 ? { caption: block.caption.trim() } : {},
|
|
7311
7617
|
...label.length > 0 ? { label, numberLabel: floatNumberLabel(document2, label, previewOptions) } : {},
|
|
7312
7618
|
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
@@ -7374,6 +7680,15 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
7374
7680
|
mathIslands
|
|
7375
7681
|
};
|
|
7376
7682
|
}
|
|
7683
|
+
|
|
7684
|
+
// src/document2/validatedLatex.ts
|
|
7685
|
+
function document2Latex2(document2, options = {}) {
|
|
7686
|
+
const validation = validateDocument2(document2);
|
|
7687
|
+
if (!validation.valid) {
|
|
7688
|
+
throw new Document2ValidationError(validation.issues);
|
|
7689
|
+
}
|
|
7690
|
+
return document2Latex(document2, options);
|
|
7691
|
+
}
|
|
7377
7692
|
export {
|
|
7378
7693
|
BUTEX_BASMALA,
|
|
7379
7694
|
BUTEX_BASMALA_LINE1,
|
|
@@ -7384,6 +7699,7 @@ export {
|
|
|
7384
7699
|
DEFAULT_HIJRI_DATE,
|
|
7385
7700
|
DEFAULT_REFERENCE_FIELD_SEPARATOR,
|
|
7386
7701
|
Document2CommandError,
|
|
7702
|
+
Document2ValidationError,
|
|
7387
7703
|
HIJRI_MONTH_IDS,
|
|
7388
7704
|
HIJRI_YEAR_MAX,
|
|
7389
7705
|
HIJRI_YEAR_MIN,
|
|
@@ -7429,7 +7745,7 @@ export {
|
|
|
7429
7745
|
document2HistoryCanRedo,
|
|
7430
7746
|
document2HistoryCanUndo,
|
|
7431
7747
|
document2KeyError,
|
|
7432
|
-
document2Latex,
|
|
7748
|
+
document2Latex2 as document2Latex,
|
|
7433
7749
|
document2Outline,
|
|
7434
7750
|
document2Preview,
|
|
7435
7751
|
emptyBlockSelection,
|
|
@@ -7446,6 +7762,7 @@ export {
|
|
|
7446
7762
|
formatRefLabel,
|
|
7447
7763
|
fromDocumentJson2,
|
|
7448
7764
|
getArabicXeLatexPreamble,
|
|
7765
|
+
hasXeLatexUnsupportedEmoji,
|
|
7449
7766
|
hijriMonthLabel,
|
|
7450
7767
|
inlineFieldLatex,
|
|
7451
7768
|
insertCiteTokenAtCaret,
|
|
@@ -7453,6 +7770,7 @@ export {
|
|
|
7453
7770
|
insertMathToken,
|
|
7454
7771
|
insertMathTokenAtCaret,
|
|
7455
7772
|
insertRefTokenAtCaret,
|
|
7773
|
+
isDocument2Valid,
|
|
7456
7774
|
isDuplicateDocument2Key,
|
|
7457
7775
|
isValidDocument2Key,
|
|
7458
7776
|
labelNumberMap,
|
|
@@ -7506,6 +7824,7 @@ export {
|
|
|
7506
7824
|
updateDocument2TextBlockCentered,
|
|
7507
7825
|
updateMathTokenLabel,
|
|
7508
7826
|
updateRefTokenKeys,
|
|
7509
|
-
updateTextToken
|
|
7827
|
+
updateTextToken,
|
|
7828
|
+
validateDocument2
|
|
7510
7829
|
};
|
|
7511
7830
|
//# sourceMappingURL=document2.mjs.map
|