officeparser 7.2.3 → 7.4.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 +277 -17
- package/dist/OfficeConverter.d.ts +1 -1
- package/dist/OfficeConverter.js +3 -0
- package/dist/OfficeGenerator.js +4 -0
- package/dist/OfficeParser.d.ts +2 -0
- package/dist/OfficeParser.js +6 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +5 -2
- package/dist/defaults.js +12 -0
- package/dist/generators/BaseGenerator.d.ts +34 -1
- package/dist/generators/BaseGenerator.js +98 -0
- package/dist/generators/CsvGenerator.d.ts +9 -1
- package/dist/generators/CsvGenerator.js +28 -16
- package/dist/generators/EpubGenerator.d.ts +43 -0
- package/dist/generators/EpubGenerator.js +312 -0
- package/dist/generators/HtmlGenerator.d.ts +12 -0
- package/dist/generators/HtmlGenerator.js +378 -61
- package/dist/generators/MarkdownGenerator.d.ts +28 -5
- package/dist/generators/MarkdownGenerator.js +432 -51
- package/dist/generators/PdfGenerator.js +32 -0
- package/dist/generators/RtfGenerator.js +47 -22
- package/dist/generators/TextGenerator.js +98 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/officeparser.browser.d.ts +427 -20
- package/dist/officeparser.browser.iife.js +338 -206
- package/dist/officeparser.browser.mjs +346 -214
- package/dist/officeparser.browser.slim.d.ts +427 -20
- package/dist/officeparser.browser.slim.iife.js +346 -214
- package/dist/officeparser.browser.slim.mjs +346 -214
- package/dist/parsers/EpubParser.d.ts +8 -0
- package/dist/parsers/EpubParser.js +217 -0
- package/dist/parsers/ExcelParser.js +2 -0
- package/dist/parsers/HtmlParser.js +507 -48
- package/dist/parsers/MarkdownParser.js +704 -92
- package/dist/parsers/OpenOfficeParser.js +128 -20
- package/dist/parsers/PdfParser.js +4 -1
- package/dist/parsers/PowerPointParser.js +1 -0
- package/dist/parsers/WordParser.js +1 -0
- package/dist/sbom.cdx.json +1695 -0
- package/dist/types.d.ts +427 -20
- package/dist/types.js +8 -0
- package/dist/utils/configUtils.js +53 -4
- package/dist/utils/errorUtils.js +7 -3
- package/dist/utils/sanitize.d.ts +139 -0
- package/dist/utils/sanitize.js +318 -0
- package/dist/utils/xmlUtils.js +2 -2
- package/dist/utils/zipUtils.js +76 -26
- package/package.json +16 -12
|
@@ -9,11 +9,11 @@ import { BaseGenerator } from './BaseGenerator.js';
|
|
|
9
9
|
* be used for these features.
|
|
10
10
|
*
|
|
11
11
|
* 2. **Fidelity vs. Purity (The `fallbackToHtml` Principle)**:
|
|
12
|
-
* - When `fallbackToHtml` is TRUE: The generator prioritizes high-fidelity
|
|
13
|
-
* conversion. It will use HTML tags for features that Markdown
|
|
14
|
-
* represent (e.g., `<u>` for underline, `<div>` for alignment, `<table>`
|
|
15
|
-
* nested structures or merged cells).
|
|
16
|
-
* - When
|
|
12
|
+
* - When a given `fallbackToHtml` part is TRUE: The generator prioritizes high-fidelity
|
|
13
|
+
* document conversion for that part. It will use HTML tags for features that Markdown
|
|
14
|
+
* cannot natively represent (e.g., `<u>` for underline, `<div>` for alignment, `<table>`
|
|
15
|
+
* for nested structures or merged cells).
|
|
16
|
+
* - When FALSE: The generator prioritizes "pure" Markdown for that part.
|
|
17
17
|
* Unsupported features are either:
|
|
18
18
|
* - **Skipped**: Non-essential formatting like underline, subscript, superscript,
|
|
19
19
|
* or text alignment is omitted.
|
|
@@ -23,15 +23,38 @@ import { BaseGenerator } from './BaseGenerator.js';
|
|
|
23
23
|
*
|
|
24
24
|
* 3. **Consistency**: All similar structural or formatting ideological problems must be
|
|
25
25
|
* resolved using these same rules to ensure predictable output.
|
|
26
|
+
*
|
|
27
|
+
* 4. **Dialect (`MdGeneratorConfig.dialect`)**: A second, independent axis from `fallbackToHtml` -
|
|
28
|
+
* which *native* Markdown syntax to emit for constructs with more than one real-world
|
|
29
|
+
* convention (admonitions, definition lists, footnotes, citations, wikilinks, math, list/
|
|
30
|
+
* emphasis markers, tables). See `resolveDialect()` and `MARKDOWN_DIALECT_PRESETS` above.
|
|
26
31
|
*/
|
|
27
32
|
export declare class MarkdownGenerator extends BaseGenerator<'md'> {
|
|
28
33
|
private isInsideTable;
|
|
29
34
|
private hoistedContent;
|
|
35
|
+
private collectedAbbreviations;
|
|
36
|
+
private resolvedDialect;
|
|
37
|
+
private resolvedFallbackToHtml;
|
|
30
38
|
constructor(ast: OfficeParserAST, config?: GeneratorConfig<'md'>);
|
|
31
39
|
/**
|
|
32
40
|
* Renders anchor tags if HTML fallback is allowed.
|
|
33
41
|
*/
|
|
34
42
|
private renderAnchors;
|
|
43
|
+
/**
|
|
44
|
+
* Serializes a frontmatter array as a YAML flow sequence (e.g. `[a, b]`), matching
|
|
45
|
+
* MarkdownParser's frontmatter array handling. Plain strings are left bare; anything
|
|
46
|
+
* that would break flow-array syntax (or isn't a string) falls back to JSON encoding.
|
|
47
|
+
*/
|
|
48
|
+
private serializeFrontmatterArray;
|
|
49
|
+
/**
|
|
50
|
+
* Renders a Pandoc-style attribute list (e.g. `{width=50% align=left}`) from
|
|
51
|
+
* ImageMetadata/TableMetadata's width/align fields - the canonical form is always
|
|
52
|
+
* `key=value`, matching MarkdownParser's own vocabulary (MARKDOWN_DIALECT.md §15).
|
|
53
|
+
*/
|
|
54
|
+
private renderAttributeList;
|
|
55
|
+
/** Converts a document-supplied date to an ISO string, or '' if invalid
|
|
56
|
+
* (a malformed date would otherwise throw a RangeError and abort generation). */
|
|
57
|
+
private toIsoDate;
|
|
35
58
|
/**
|
|
36
59
|
* Generates Markdown string from the provided AST.
|
|
37
60
|
*
|