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.
Files changed (49) hide show
  1. package/README.md +277 -17
  2. package/dist/OfficeConverter.d.ts +1 -1
  3. package/dist/OfficeConverter.js +3 -0
  4. package/dist/OfficeGenerator.js +4 -0
  5. package/dist/OfficeParser.d.ts +2 -0
  6. package/dist/OfficeParser.js +6 -0
  7. package/dist/cli.d.ts +1 -1
  8. package/dist/cli.js +5 -2
  9. package/dist/defaults.js +12 -0
  10. package/dist/generators/BaseGenerator.d.ts +34 -1
  11. package/dist/generators/BaseGenerator.js +98 -0
  12. package/dist/generators/CsvGenerator.d.ts +9 -1
  13. package/dist/generators/CsvGenerator.js +28 -16
  14. package/dist/generators/EpubGenerator.d.ts +43 -0
  15. package/dist/generators/EpubGenerator.js +312 -0
  16. package/dist/generators/HtmlGenerator.d.ts +12 -0
  17. package/dist/generators/HtmlGenerator.js +378 -61
  18. package/dist/generators/MarkdownGenerator.d.ts +28 -5
  19. package/dist/generators/MarkdownGenerator.js +432 -51
  20. package/dist/generators/PdfGenerator.js +32 -0
  21. package/dist/generators/RtfGenerator.js +47 -22
  22. package/dist/generators/TextGenerator.js +98 -11
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/officeparser.browser.d.ts +427 -20
  26. package/dist/officeparser.browser.iife.js +338 -206
  27. package/dist/officeparser.browser.mjs +346 -214
  28. package/dist/officeparser.browser.slim.d.ts +427 -20
  29. package/dist/officeparser.browser.slim.iife.js +346 -214
  30. package/dist/officeparser.browser.slim.mjs +346 -214
  31. package/dist/parsers/EpubParser.d.ts +8 -0
  32. package/dist/parsers/EpubParser.js +217 -0
  33. package/dist/parsers/ExcelParser.js +2 -0
  34. package/dist/parsers/HtmlParser.js +507 -48
  35. package/dist/parsers/MarkdownParser.js +704 -92
  36. package/dist/parsers/OpenOfficeParser.js +128 -20
  37. package/dist/parsers/PdfParser.js +4 -1
  38. package/dist/parsers/PowerPointParser.js +1 -0
  39. package/dist/parsers/WordParser.js +1 -0
  40. package/dist/sbom.cdx.json +1695 -0
  41. package/dist/types.d.ts +427 -20
  42. package/dist/types.js +8 -0
  43. package/dist/utils/configUtils.js +53 -4
  44. package/dist/utils/errorUtils.js +7 -3
  45. package/dist/utils/sanitize.d.ts +139 -0
  46. package/dist/utils/sanitize.js +318 -0
  47. package/dist/utils/xmlUtils.js +2 -2
  48. package/dist/utils/zipUtils.js +76 -26
  49. 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 document
13
- * conversion. It will use HTML tags for features that Markdown cannot natively
14
- * represent (e.g., `<u>` for underline, `<div>` for alignment, `<table>` for
15
- * nested structures or merged cells).
16
- * - When `fallbackToHtml` is FALSE: The generator prioritizes "pure" Markdown.
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
  *