officeparser 7.2.0 → 7.2.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.
@@ -7,6 +7,8 @@
7
7
  export declare enum OfficeErrorType {
8
8
  /** Unsupported file extension */
9
9
  EXTENSION_UNSUPPORTED = "EXTENSION_UNSUPPORTED",
10
+ /** Unsupported output generator format */
11
+ FORMAT_UNSUPPORTED = "FORMAT_UNSUPPORTED",
10
12
  /** File appears to be corrupted or malformed */
11
13
  FILE_CORRUPTED = "FILE_CORRUPTED",
12
14
  /** File could not be found at the specified path */
@@ -397,7 +399,7 @@ export interface CommonGeneratorConfig {
397
399
  * 1. **Filter/Remove Nodes**: Return `false` to skip a node and all its children.
398
400
  * 2. **Override Rendering**: Return a `string` to use that exact text as the output, bypassing default logic and recursion.
399
401
  * 3. **Mutate Nodes**: Modify the `node` object directly (e.g., changing `node.text`) and return `void` to let the generator proceed with your changes.
400
- * 4. **Async Support**: The callback can be `async`, allowing you to fetch external data or perform complex logic during generation.
402
+ * 4. **Async Support**: The callback can be `async`, allowing you to load external data or perform complex logic during generation.
401
403
  */
402
404
  onNode?: (node: OfficeContentNode) => string | false | Promise<string | false | void> | void;
403
405
  /**
@@ -1860,7 +1862,7 @@ export declare class OfficeParser {
1860
1862
  * });
1861
1863
  *
1862
1864
  * // Parse a Buffer with OCR enabled
1863
- * const buffer = await fetch('document.pdf').then(r => r.arrayBuffer());
1865
+ * const buffer = await retrieveData('document.pdf').then(r => r.arrayBuffer());
1864
1866
  * const ast = await OfficeParser.parseOffice(buffer, {
1865
1867
  * ocr: true,
1866
1868
  * ocrLanguage: 'eng+fra'
@@ -1885,6 +1887,10 @@ export declare class OfficeParser {
1885
1887
  * Main generator class providing document conversion functionality.
1886
1888
  */
1887
1889
  export declare class OfficeGenerator {
1890
+ /**
1891
+ * Normalizes format aliases (e.g., 'txt' to 'text', 'markdown' to 'md') to standard internal formats.
1892
+ */
1893
+ static normalizeDestination(dest: string): UniversalGeneratorFormat;
1888
1894
  /**
1889
1895
  * Generates a file of the specified type from an AST.
1890
1896
  * This is the single source of truth for generation logic.