officeparser 7.6.1 → 7.7.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/dist/types.d.ts CHANGED
@@ -1065,6 +1065,35 @@ export interface CsvGeneratorConfig {
1065
1065
  * historical output exactly (every feature on, GitHub-style admonitions).
1066
1066
  */
1067
1067
  export type MarkdownDialectPreset = 'extended' | 'github' | 'gitlab' | 'obsidian' | 'pandoc' | 'commonmark';
1068
+ /** Admonition syntax: `'blockquote'` = GitHub `> [!NOTE]`, `'fence'` = GitLab `:::note`,
1069
+ * `'fence-attribute'` = Pandoc `::: {.note}`, `'none'` = plain bold-labeled blockquote. */
1070
+ export type AdmonitionSyntax = 'blockquote' | 'fence' | 'fence-attribute' | 'none';
1071
+ /** `==text==` highlight (`'equals'`), or `'none'` to disable. */
1072
+ export type HighlightSyntax = 'equals' | 'none';
1073
+ /** GFM `~~text~~` strikethrough (`'tilde'`), or `'none'`. */
1074
+ export type StrikethroughSyntax = 'tilde' | 'none';
1075
+ /** `Term`/`: Description` definition lists (`'colon'`), or `'none'`. */
1076
+ export type DefinitionListSyntax = 'colon' | 'none';
1077
+ /** `[^id]` footnotes (`'caret'`), or `'none'`. */
1078
+ export type FootnoteSyntax = 'caret' | 'none';
1079
+ /** `[@citekey]` citations (`'at'`), or `'none'`. */
1080
+ export type CitationSyntax = 'at' | 'none';
1081
+ /** `[[Page]]` wikilinks (`'double-bracket'`), or `'none'`. */
1082
+ export type WikilinkSyntax = 'double-bracket' | 'none';
1083
+ /** `{width=50%}` attribute lists (`'brace'`), or `'none'`. */
1084
+ export type AttributeListSyntax = 'brace' | 'none';
1085
+ /**
1086
+ * @deprecated Legacy flavor names for `MarkdownDialectConfig.admonitions`. Use the syntax names
1087
+ * instead: `'github'` -> `'blockquote'`, `'gitlab'` -> `'fence'`, `'pandoc'` -> `'fence-attribute'`.
1088
+ * These aliases still resolve to the same output and will be removed in the next major version.
1089
+ */
1090
+ export type DeprecatedAdmonitionFlavor = 'github' | 'gitlab' | 'pandoc';
1091
+ /**
1092
+ * @deprecated Boolean toggles for dialect capability fields are deprecated in favor of the
1093
+ * syntax-name unions: `true` maps to that field's on-value (e.g. `'tilde'`), `false` maps to
1094
+ * `'none'`. Booleans keep working via coercion and will be removed in the next major version.
1095
+ */
1096
+ export type DeprecatedDialectToggle = boolean;
1068
1097
  /**
1069
1098
  * Granular control over which native Markdown syntax the generator emits for constructs that
1070
1099
  * differ across real-world dialects (e.g. GitHub's `> [!NOTE]` vs GitLab's `:::note` vs Pandoc's
@@ -1076,25 +1105,60 @@ export type MarkdownDialectPreset = 'extended' | 'github' | 'gitlab' | 'obsidian
1076
1105
  export interface MarkdownDialectConfig {
1077
1106
  /** Base preset any omitted field inherits from. Defaults to 'extended'. */
1078
1107
  extends?: MarkdownDialectPreset;
1079
- /** Admonition syntax: GitHub `> [!NOTE]`, GitLab `:::note`, Pandoc `::: {.note}`, or `'none'`
1080
- * to degrade to a plain bold-labeled blockquote with no special marker. */
1081
- admonitions?: 'github' | 'gitlab' | 'pandoc' | 'none';
1082
- /** Markdown Extra/Pandoc-style `Term\n: Description` definition lists. */
1083
- definitionLists?: boolean;
1084
- /** `[^id]` footnote references/definitions. When false, note content is inlined as a
1085
- * parenthetical right at the reference point instead of using footnote syntax. */
1086
- footnotes?: boolean;
1087
- /** Pandoc-style `[@citekey]` citations. When false, emits `[citekey]` (brackets, no `@`). */
1088
- citations?: boolean;
1089
- /** Obsidian-style `[[Page]]`/`[[Page|Alias]]` wikilinks. When false, falls back to a plain
1090
- * `[text](url)` link using the same target. */
1091
- wikilinks?: boolean;
1092
- /** Inline `$...$`/block `$$...$$` math delimiters, or `'none'` for bare LaTeX text. */
1108
+ /**
1109
+ * Admonition syntax: `'blockquote'` = GitHub `> [!NOTE]`, `'fence'` = GitLab `:::note`,
1110
+ * `'fence-attribute'` = Pandoc `::: {.note}`, `'none'` = a plain bold-labeled blockquote with no
1111
+ * special marker. Omit to inherit from the `extends` preset. The legacy flavor names
1112
+ * `'github'`/`'gitlab'`/`'pandoc'` are accepted as deprecated aliases (see
1113
+ * `DeprecatedAdmonitionFlavor`) and will be removed in the next major version.
1114
+ */
1115
+ admonitions?: AdmonitionSyntax | DeprecatedAdmonitionFlavor;
1116
+ /**
1117
+ * Markdown Extra/Pandoc-style `Term`/`: Description` definition lists (`'colon'`), or `'none'`
1118
+ * to render terms and descriptions as plain paragraphs. Omit to inherit from `extends`. Passing
1119
+ * a boolean is deprecated: `true` = `'colon'`, `false` = `'none'` (removed next major).
1120
+ */
1121
+ definitionLists?: DefinitionListSyntax | DeprecatedDialectToggle;
1122
+ /**
1123
+ * `[^id]` footnote references/definitions (`'caret'`), or `'none'` to inline note content as a
1124
+ * parenthetical right at the reference point. Omit to inherit from `extends`. Passing a boolean
1125
+ * is deprecated: `true` = `'caret'`, `false` = `'none'` (removed next major).
1126
+ */
1127
+ footnotes?: FootnoteSyntax | DeprecatedDialectToggle;
1128
+ /**
1129
+ * Pandoc-style `[@citekey]` citations (`'at'`), or `'none'` to emit `[citekey]` (brackets, no
1130
+ * `@`). Omit to inherit from `extends`. Passing a boolean is deprecated: `true` = `'at'`,
1131
+ * `false` = `'none'` (removed next major).
1132
+ */
1133
+ citations?: CitationSyntax | DeprecatedDialectToggle;
1134
+ /**
1135
+ * Obsidian-style `[[Page]]`/`[[Page|Alias]]` wikilinks (`'double-bracket'`), or `'none'` to fall
1136
+ * back to a plain `[text](url)` link using the same target. Omit to inherit from `extends`.
1137
+ * Passing a boolean is deprecated: `true` = `'double-bracket'`, `false` = `'none'` (removed next major).
1138
+ */
1139
+ wikilinks?: WikilinkSyntax | DeprecatedDialectToggle;
1140
+ /** Inline `$...$`/block `$$...$$` math delimiters (`'dollar'`), or `'none'` for bare LaTeX text. */
1093
1141
  math?: 'dollar' | 'none';
1094
- /** Pandoc-style `{width=50% .centered}` attribute lists after images/tables. */
1095
- attributeLists?: boolean;
1096
- /** GFM `~~text~~` strikethrough (not part of base CommonMark). */
1097
- strikethrough?: boolean;
1142
+ /**
1143
+ * Pandoc-style `{width=50% .centered}` attribute lists after images/tables (`'brace'`), or
1144
+ * `'none'`. Omit to inherit from `extends`. Passing a boolean is deprecated: `true` = `'brace'`,
1145
+ * `false` = `'none'` (removed next major).
1146
+ */
1147
+ attributeLists?: AttributeListSyntax | DeprecatedDialectToggle;
1148
+ /**
1149
+ * GFM `~~text~~` strikethrough (`'tilde'`; not part of base CommonMark), or `'none'`. Omit to
1150
+ * inherit from `extends`. Passing a boolean is deprecated: `true` = `'tilde'`, `false` = `'none'`
1151
+ * (removed next major).
1152
+ */
1153
+ strikethrough?: StrikethroughSyntax | DeprecatedDialectToggle;
1154
+ /**
1155
+ * `==text==` highlight (`'equals'`; Obsidian/extended flavors, NOT GFM or CommonMark where `==`
1156
+ * is literal text), or `'none'`. When `'equals'`, a highlighted run round-trips as `==text==`
1157
+ * and `==text==` is read back as a highlight; when `'none'`, a highlight falls back to an HTML
1158
+ * `<mark>`/`<span>` per `fallbackToHtml.inlineFormatting`, and `==text==` stays literal on parse.
1159
+ * Omit to inherit from `extends`.
1160
+ */
1161
+ highlight?: HighlightSyntax;
1098
1162
  /** Unordered list bullet character. */
1099
1163
  bulletListMarker?: '-' | '*' | '+';
1100
1164
  /** Ordered list marker punctuation. */
@@ -1124,6 +1188,13 @@ export interface FallbackToHtmlConfig {
1124
1188
  embeds?: boolean;
1125
1189
  /** Multi-line table cell content joined with `<br>` instead of a space. */
1126
1190
  cellLineBreaks?: boolean;
1191
+ /**
1192
+ * Multi-paragraph list-item content (an HTML `<li>` with several `<p>` children) joined with
1193
+ * `<br>` instead of a space, so it stays on the item's single Markdown line. Block children of
1194
+ * an item (a code fence or table inside `<li>`) degrade under this join, the same way they do
1195
+ * inside a table cell under `cellLineBreaks`.
1196
+ */
1197
+ itemLineBreaks?: boolean;
1127
1198
  /**
1128
1199
  * Inline text color, highlight, and font size via a `<span style="color:...;background-color:...;
1129
1200
  * font-size:...">` run, which the Markdown parser reads back. These have no Markdown syntax and
@@ -1630,6 +1701,12 @@ export interface CellMetadata {
1630
1701
  * @example 0 for column A, 1 for column B, etc.
1631
1702
  */
1632
1703
  col: number;
1704
+ /**
1705
+ * Text alignment for this cell's column, from the GFM pipe-table separator row
1706
+ * (`:---` left, `:---:` center, `---:` right). All cells in a column carry the same value;
1707
+ * the Markdown generator reads it from the header row to emit the separator.
1708
+ */
1709
+ align?: 'left' | 'center' | 'right';
1633
1710
  /**
1634
1711
  * The number of rows this cell spans (merges).
1635
1712
  * @example 2 if the cell is merged with the one below it.
@@ -1708,6 +1785,8 @@ export interface ImageMetadata {
1708
1785
  * @example 'center'
1709
1786
  */
1710
1787
  align?: 'left' | 'center' | 'right';
1788
+ /** Advisory image title (Markdown `![alt](url "title")`, HTML `<img title>`), if any. */
1789
+ title?: string;
1711
1790
  }
1712
1791
  /**
1713
1792
  * Metadata for an embedded external media node (e.g. a YouTube video).
@@ -1791,6 +1870,8 @@ export interface TextMetadata {
1791
1870
  * officeParser always parses/generates the syntax.
1792
1871
  */
1793
1872
  wikilink?: boolean;
1873
+ /** Advisory link title (Markdown `[text](url "title")`, HTML `<a title>`), if any. */
1874
+ title?: string;
1794
1875
  }
1795
1876
  /**
1796
1877
  * Metadata for note nodes (footnotes/endnotes).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "officeparser",
3
- "version": "7.6.1",
3
+ "version": "7.7.0",
4
4
  "description": "A robust, strictly-typed Node.js and Browser library for parsing office files (.docx, .pptx, .xlsx, .odt, .odp, .ods, .pdf, .rtf, .csv, .md, .html, .epub) and generating high-fidelity outputs in Markdown, HTML, CSV, RTF, PDF, EPUB, and RAG-focused chunks.",
5
5
  "funding": "https://github.com/sponsors/harshankur",
6
6
  "main": "dist/index.js",