@ai-matrx/print 0.8.3 → 0.8.5
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/CHANGELOG.md +26 -0
- package/dist/document.cjs +202 -97
- package/dist/document.cjs.map +1 -1
- package/dist/document.d.cts +21 -2
- package/dist/document.d.ts +21 -2
- package/dist/document.js +203 -98
- package/dist/document.js.map +1 -1
- package/package.json +2 -1
package/dist/document.d.cts
CHANGED
|
@@ -21,7 +21,16 @@ interface MathSpan {
|
|
|
21
21
|
tex: string;
|
|
22
22
|
display: boolean;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Replace every math span with a private-use token; returns the spans.
|
|
26
|
+
*
|
|
27
|
+
* Print keeps NO fence, code-span or math detection of its own: the spans are
|
|
28
|
+
* the shared tokenizer's complete `math_block` / `math_inline` islands
|
|
29
|
+
* (`tokenizeSource` + `listIslands` from `@ai-matrx/content-ir/source` — the
|
|
30
|
+
* one fence-nesting rule and the one math pairing), so print, the renderer and
|
|
31
|
+
* the editor can never disagree about what is math. The delimiter decides the
|
|
32
|
+
* form: `$$`/`\[` display, `$`/`\(` inline.
|
|
33
|
+
*/
|
|
25
34
|
declare function extractMath(body: string): {
|
|
26
35
|
text: string;
|
|
27
36
|
spans: MathSpan[];
|
|
@@ -322,14 +331,22 @@ interface FallbackFontLoaders {
|
|
|
322
331
|
emoji?: FontLoader | undefined;
|
|
323
332
|
symbols?: FontLoader | undefined;
|
|
324
333
|
cjk?: CjkFontLoader | undefined;
|
|
334
|
+
arabic?: FontLoader | undefined;
|
|
335
|
+
hebrew?: FontLoader | undefined;
|
|
325
336
|
}
|
|
326
337
|
/** Noto Sans JP (SIL OFL) from fontsource: 124 unicode-range subsets; only the needed ones load. */
|
|
327
338
|
declare const NOTO_CJK_BASE = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-jp@5.3.0";
|
|
339
|
+
/** Noto Sans KR (SIL OFL) — Hangul, same unicode-range scheme. */
|
|
340
|
+
declare const NOTO_KR_BASE = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-kr@5.3.0";
|
|
341
|
+
/** Noto Sans Arabic / Hebrew (SIL OFL) — one script subset each. */
|
|
342
|
+
declare const NOTO_ARABIC_URL = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-arabic@5.3.0/files/noto-sans-arabic-arabic-400-normal.woff";
|
|
343
|
+
declare const NOTO_HEBREW_URL = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-hebrew@5.3.0/files/noto-sans-hebrew-hebrew-400-normal.woff";
|
|
328
344
|
/** Parse a fontsource stylesheet: each face's file stem and its unicode ranges. */
|
|
329
345
|
declare function parseUnicodeRangeCss(css: string): Array<{
|
|
330
346
|
file: string;
|
|
331
347
|
ranges: Array<[number, number]>;
|
|
332
348
|
}>;
|
|
349
|
+
/** Hangul from Noto Sans KR, every other CJK character from Noto Sans JP. */
|
|
333
350
|
declare const defaultCjkFontLoader: CjkFontLoader;
|
|
334
351
|
/**
|
|
335
352
|
* Words pdfmake did not put on a page: a text node with no position was never
|
|
@@ -416,6 +433,8 @@ declare class CitationEngine {
|
|
|
416
433
|
/** A note style: every citation becomes a numbered note. */
|
|
417
434
|
readonly isNote: boolean;
|
|
418
435
|
private readonly numeric;
|
|
436
|
+
/** APA 7 §8.11: narrative citations join authors with "and", not "&". */
|
|
437
|
+
private readonly apaNarrativeAnd;
|
|
419
438
|
constructor(styleXml: string, localeXml: string, items: CslItem[], lang: string);
|
|
420
439
|
/** Cite a group; `noteIndex` is the note number for note styles (0 = in text). */
|
|
421
440
|
cite(refs: CiteRef[], opts?: {
|
|
@@ -671,4 +690,4 @@ declare function exportDocument(source: string, format: DocumentFormat, options?
|
|
|
671
690
|
/** Browser helper: save an export through a download link. */
|
|
672
691
|
declare function downloadDocumentExport(exp: DocumentExport): void;
|
|
673
692
|
|
|
674
|
-
export { BUNDLED_STYLE_IDS, type BibliographyEntry, type Block, CSL_STYLE_ALIASES, type Caption, CitationEngine, type CitationStyle, type CjkFontLoader, type CslFetcher, type CslItem, type CslName, DEFAULT_FOOTER, DOCUMENT_FORMATS, type DocSection, type DocTree, type DocumentExport, type DocumentFormat, type DocumentNotice, type DocumentSettings, type ExportDocumentOptions, type FallbackFontLoaders, type FontLoader, type ImageLoader, type ImageMap, type Inline, type ListItem, type Margins, type MathSpan, NOTO_CJK_BASE, NOTO_EMOJI_URL, NOTO_SYMBOLS_URL, type Orientation, PAGE_SIZES, type PageSizeName, type ParseDocumentOptions, type PrepareDocumentOptions, type ResolvedImage, type RunningTemplate, type TocEntry, type TypesetMath, buildPdfDefinition, countUnplacedWords, cslStyleId, defaultCjkFontLoader, defaultCslFetcher, defaultEmojiFontLoader, defaultImageLoader, defaultSymbolFontLoader, documentCss, documentToDocx, documentToEpub, documentToHtml, documentToPdf, downloadDocumentExport, exportDocument, extractMath, fillTemplate, loadCslLocale, loadCslStyle, mathKey, normalizeReference, parseCitationGroup, parseDocument, parseLength, parseLocator, parseMathML, parseUnicodeRangeCss, plainText, prepareDocument, renderBlocksHtml, renderPdfDefinition, resolveDocumentImages, resolveSettings, scanCitationKeys, splitFrontmatter, typesetDocumentMath };
|
|
693
|
+
export { BUNDLED_STYLE_IDS, type BibliographyEntry, type Block, CSL_STYLE_ALIASES, type Caption, CitationEngine, type CitationStyle, type CjkFontLoader, type CslFetcher, type CslItem, type CslName, DEFAULT_FOOTER, DOCUMENT_FORMATS, type DocSection, type DocTree, type DocumentExport, type DocumentFormat, type DocumentNotice, type DocumentSettings, type ExportDocumentOptions, type FallbackFontLoaders, type FontLoader, type ImageLoader, type ImageMap, type Inline, type ListItem, type Margins, type MathSpan, NOTO_ARABIC_URL, NOTO_CJK_BASE, NOTO_EMOJI_URL, NOTO_HEBREW_URL, NOTO_KR_BASE, NOTO_SYMBOLS_URL, type Orientation, PAGE_SIZES, type PageSizeName, type ParseDocumentOptions, type PrepareDocumentOptions, type ResolvedImage, type RunningTemplate, type TocEntry, type TypesetMath, buildPdfDefinition, countUnplacedWords, cslStyleId, defaultCjkFontLoader, defaultCslFetcher, defaultEmojiFontLoader, defaultImageLoader, defaultSymbolFontLoader, documentCss, documentToDocx, documentToEpub, documentToHtml, documentToPdf, downloadDocumentExport, exportDocument, extractMath, fillTemplate, loadCslLocale, loadCslStyle, mathKey, normalizeReference, parseCitationGroup, parseDocument, parseLength, parseLocator, parseMathML, parseUnicodeRangeCss, plainText, prepareDocument, renderBlocksHtml, renderPdfDefinition, resolveDocumentImages, resolveSettings, scanCitationKeys, splitFrontmatter, typesetDocumentMath };
|
package/dist/document.d.ts
CHANGED
|
@@ -21,7 +21,16 @@ interface MathSpan {
|
|
|
21
21
|
tex: string;
|
|
22
22
|
display: boolean;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Replace every math span with a private-use token; returns the spans.
|
|
26
|
+
*
|
|
27
|
+
* Print keeps NO fence, code-span or math detection of its own: the spans are
|
|
28
|
+
* the shared tokenizer's complete `math_block` / `math_inline` islands
|
|
29
|
+
* (`tokenizeSource` + `listIslands` from `@ai-matrx/content-ir/source` — the
|
|
30
|
+
* one fence-nesting rule and the one math pairing), so print, the renderer and
|
|
31
|
+
* the editor can never disagree about what is math. The delimiter decides the
|
|
32
|
+
* form: `$$`/`\[` display, `$`/`\(` inline.
|
|
33
|
+
*/
|
|
25
34
|
declare function extractMath(body: string): {
|
|
26
35
|
text: string;
|
|
27
36
|
spans: MathSpan[];
|
|
@@ -322,14 +331,22 @@ interface FallbackFontLoaders {
|
|
|
322
331
|
emoji?: FontLoader | undefined;
|
|
323
332
|
symbols?: FontLoader | undefined;
|
|
324
333
|
cjk?: CjkFontLoader | undefined;
|
|
334
|
+
arabic?: FontLoader | undefined;
|
|
335
|
+
hebrew?: FontLoader | undefined;
|
|
325
336
|
}
|
|
326
337
|
/** Noto Sans JP (SIL OFL) from fontsource: 124 unicode-range subsets; only the needed ones load. */
|
|
327
338
|
declare const NOTO_CJK_BASE = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-jp@5.3.0";
|
|
339
|
+
/** Noto Sans KR (SIL OFL) — Hangul, same unicode-range scheme. */
|
|
340
|
+
declare const NOTO_KR_BASE = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-kr@5.3.0";
|
|
341
|
+
/** Noto Sans Arabic / Hebrew (SIL OFL) — one script subset each. */
|
|
342
|
+
declare const NOTO_ARABIC_URL = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-arabic@5.3.0/files/noto-sans-arabic-arabic-400-normal.woff";
|
|
343
|
+
declare const NOTO_HEBREW_URL = "https://cdn.jsdelivr.net/npm/@fontsource/noto-sans-hebrew@5.3.0/files/noto-sans-hebrew-hebrew-400-normal.woff";
|
|
328
344
|
/** Parse a fontsource stylesheet: each face's file stem and its unicode ranges. */
|
|
329
345
|
declare function parseUnicodeRangeCss(css: string): Array<{
|
|
330
346
|
file: string;
|
|
331
347
|
ranges: Array<[number, number]>;
|
|
332
348
|
}>;
|
|
349
|
+
/** Hangul from Noto Sans KR, every other CJK character from Noto Sans JP. */
|
|
333
350
|
declare const defaultCjkFontLoader: CjkFontLoader;
|
|
334
351
|
/**
|
|
335
352
|
* Words pdfmake did not put on a page: a text node with no position was never
|
|
@@ -416,6 +433,8 @@ declare class CitationEngine {
|
|
|
416
433
|
/** A note style: every citation becomes a numbered note. */
|
|
417
434
|
readonly isNote: boolean;
|
|
418
435
|
private readonly numeric;
|
|
436
|
+
/** APA 7 §8.11: narrative citations join authors with "and", not "&". */
|
|
437
|
+
private readonly apaNarrativeAnd;
|
|
419
438
|
constructor(styleXml: string, localeXml: string, items: CslItem[], lang: string);
|
|
420
439
|
/** Cite a group; `noteIndex` is the note number for note styles (0 = in text). */
|
|
421
440
|
cite(refs: CiteRef[], opts?: {
|
|
@@ -671,4 +690,4 @@ declare function exportDocument(source: string, format: DocumentFormat, options?
|
|
|
671
690
|
/** Browser helper: save an export through a download link. */
|
|
672
691
|
declare function downloadDocumentExport(exp: DocumentExport): void;
|
|
673
692
|
|
|
674
|
-
export { BUNDLED_STYLE_IDS, type BibliographyEntry, type Block, CSL_STYLE_ALIASES, type Caption, CitationEngine, type CitationStyle, type CjkFontLoader, type CslFetcher, type CslItem, type CslName, DEFAULT_FOOTER, DOCUMENT_FORMATS, type DocSection, type DocTree, type DocumentExport, type DocumentFormat, type DocumentNotice, type DocumentSettings, type ExportDocumentOptions, type FallbackFontLoaders, type FontLoader, type ImageLoader, type ImageMap, type Inline, type ListItem, type Margins, type MathSpan, NOTO_CJK_BASE, NOTO_EMOJI_URL, NOTO_SYMBOLS_URL, type Orientation, PAGE_SIZES, type PageSizeName, type ParseDocumentOptions, type PrepareDocumentOptions, type ResolvedImage, type RunningTemplate, type TocEntry, type TypesetMath, buildPdfDefinition, countUnplacedWords, cslStyleId, defaultCjkFontLoader, defaultCslFetcher, defaultEmojiFontLoader, defaultImageLoader, defaultSymbolFontLoader, documentCss, documentToDocx, documentToEpub, documentToHtml, documentToPdf, downloadDocumentExport, exportDocument, extractMath, fillTemplate, loadCslLocale, loadCslStyle, mathKey, normalizeReference, parseCitationGroup, parseDocument, parseLength, parseLocator, parseMathML, parseUnicodeRangeCss, plainText, prepareDocument, renderBlocksHtml, renderPdfDefinition, resolveDocumentImages, resolveSettings, scanCitationKeys, splitFrontmatter, typesetDocumentMath };
|
|
693
|
+
export { BUNDLED_STYLE_IDS, type BibliographyEntry, type Block, CSL_STYLE_ALIASES, type Caption, CitationEngine, type CitationStyle, type CjkFontLoader, type CslFetcher, type CslItem, type CslName, DEFAULT_FOOTER, DOCUMENT_FORMATS, type DocSection, type DocTree, type DocumentExport, type DocumentFormat, type DocumentNotice, type DocumentSettings, type ExportDocumentOptions, type FallbackFontLoaders, type FontLoader, type ImageLoader, type ImageMap, type Inline, type ListItem, type Margins, type MathSpan, NOTO_ARABIC_URL, NOTO_CJK_BASE, NOTO_EMOJI_URL, NOTO_HEBREW_URL, NOTO_KR_BASE, NOTO_SYMBOLS_URL, type Orientation, PAGE_SIZES, type PageSizeName, type ParseDocumentOptions, type PrepareDocumentOptions, type ResolvedImage, type RunningTemplate, type TocEntry, type TypesetMath, buildPdfDefinition, countUnplacedWords, cslStyleId, defaultCjkFontLoader, defaultCslFetcher, defaultEmojiFontLoader, defaultImageLoader, defaultSymbolFontLoader, documentCss, documentToDocx, documentToEpub, documentToHtml, documentToPdf, downloadDocumentExport, exportDocument, extractMath, fillTemplate, loadCslLocale, loadCslStyle, mathKey, normalizeReference, parseCitationGroup, parseDocument, parseLength, parseLocator, parseMathML, parseUnicodeRangeCss, plainText, prepareDocument, renderBlocksHtml, renderPdfDefinition, resolveDocumentImages, resolveSettings, scanCitationKeys, splitFrontmatter, typesetDocumentMath };
|