officeparser 7.6.2 → 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/README.md +6 -2
- package/dist/generators/HtmlGenerator.js +53 -14
- package/dist/generators/MarkdownGenerator.js +111 -40
- package/dist/officeparser.browser.d.ts +99 -18
- package/dist/officeparser.browser.iife.js +187 -180
- package/dist/officeparser.browser.mjs +187 -180
- package/dist/officeparser.browser.slim.d.ts +99 -18
- package/dist/officeparser.browser.slim.iife.js +168 -161
- package/dist/officeparser.browser.slim.mjs +168 -161
- package/dist/parsers/HtmlParser.js +36 -3
- package/dist/parsers/MarkdownParser.js +73 -8
- package/dist/sbom.cdx.json +161 -93
- package/dist/types.d.ts +99 -18
- package/package.json +1 -1
|
@@ -1039,6 +1039,35 @@ export interface CsvGeneratorConfig {
|
|
|
1039
1039
|
* historical output exactly (every feature on, GitHub-style admonitions).
|
|
1040
1040
|
*/
|
|
1041
1041
|
export type MarkdownDialectPreset = "extended" | "github" | "gitlab" | "obsidian" | "pandoc" | "commonmark";
|
|
1042
|
+
/** Admonition syntax: `'blockquote'` = GitHub `> [!NOTE]`, `'fence'` = GitLab `:::note`,
|
|
1043
|
+
* `'fence-attribute'` = Pandoc `::: {.note}`, `'none'` = plain bold-labeled blockquote. */
|
|
1044
|
+
export type AdmonitionSyntax = "blockquote" | "fence" | "fence-attribute" | "none";
|
|
1045
|
+
/** `==text==` highlight (`'equals'`), or `'none'` to disable. */
|
|
1046
|
+
export type HighlightSyntax = "equals" | "none";
|
|
1047
|
+
/** GFM `~~text~~` strikethrough (`'tilde'`), or `'none'`. */
|
|
1048
|
+
export type StrikethroughSyntax = "tilde" | "none";
|
|
1049
|
+
/** `Term`/`: Description` definition lists (`'colon'`), or `'none'`. */
|
|
1050
|
+
export type DefinitionListSyntax = "colon" | "none";
|
|
1051
|
+
/** `[^id]` footnotes (`'caret'`), or `'none'`. */
|
|
1052
|
+
export type FootnoteSyntax = "caret" | "none";
|
|
1053
|
+
/** `[@citekey]` citations (`'at'`), or `'none'`. */
|
|
1054
|
+
export type CitationSyntax = "at" | "none";
|
|
1055
|
+
/** `[[Page]]` wikilinks (`'double-bracket'`), or `'none'`. */
|
|
1056
|
+
export type WikilinkSyntax = "double-bracket" | "none";
|
|
1057
|
+
/** `{width=50%}` attribute lists (`'brace'`), or `'none'`. */
|
|
1058
|
+
export type AttributeListSyntax = "brace" | "none";
|
|
1059
|
+
/**
|
|
1060
|
+
* @deprecated Legacy flavor names for `MarkdownDialectConfig.admonitions`. Use the syntax names
|
|
1061
|
+
* instead: `'github'` -> `'blockquote'`, `'gitlab'` -> `'fence'`, `'pandoc'` -> `'fence-attribute'`.
|
|
1062
|
+
* These aliases still resolve to the same output and will be removed in the next major version.
|
|
1063
|
+
*/
|
|
1064
|
+
export type DeprecatedAdmonitionFlavor = "github" | "gitlab" | "pandoc";
|
|
1065
|
+
/**
|
|
1066
|
+
* @deprecated Boolean toggles for dialect capability fields are deprecated in favor of the
|
|
1067
|
+
* syntax-name unions: `true` maps to that field's on-value (e.g. `'tilde'`), `false` maps to
|
|
1068
|
+
* `'none'`. Booleans keep working via coercion and will be removed in the next major version.
|
|
1069
|
+
*/
|
|
1070
|
+
export type DeprecatedDialectToggle = boolean;
|
|
1042
1071
|
/**
|
|
1043
1072
|
* Granular control over which native Markdown syntax the generator emits for constructs that
|
|
1044
1073
|
* differ across real-world dialects (e.g. GitHub's `> [!NOTE]` vs GitLab's `:::note` vs Pandoc's
|
|
@@ -1050,25 +1079,60 @@ export type MarkdownDialectPreset = "extended" | "github" | "gitlab" | "obsidian
|
|
|
1050
1079
|
export interface MarkdownDialectConfig {
|
|
1051
1080
|
/** Base preset any omitted field inherits from. Defaults to 'extended'. */
|
|
1052
1081
|
extends?: MarkdownDialectPreset;
|
|
1053
|
-
/**
|
|
1054
|
-
*
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
/**
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
*
|
|
1065
|
-
|
|
1066
|
-
|
|
1082
|
+
/**
|
|
1083
|
+
* Admonition syntax: `'blockquote'` = GitHub `> [!NOTE]`, `'fence'` = GitLab `:::note`,
|
|
1084
|
+
* `'fence-attribute'` = Pandoc `::: {.note}`, `'none'` = a plain bold-labeled blockquote with no
|
|
1085
|
+
* special marker. Omit to inherit from the `extends` preset. The legacy flavor names
|
|
1086
|
+
* `'github'`/`'gitlab'`/`'pandoc'` are accepted as deprecated aliases (see
|
|
1087
|
+
* `DeprecatedAdmonitionFlavor`) and will be removed in the next major version.
|
|
1088
|
+
*/
|
|
1089
|
+
admonitions?: AdmonitionSyntax | DeprecatedAdmonitionFlavor;
|
|
1090
|
+
/**
|
|
1091
|
+
* Markdown Extra/Pandoc-style `Term`/`: Description` definition lists (`'colon'`), or `'none'`
|
|
1092
|
+
* to render terms and descriptions as plain paragraphs. Omit to inherit from `extends`. Passing
|
|
1093
|
+
* a boolean is deprecated: `true` = `'colon'`, `false` = `'none'` (removed next major).
|
|
1094
|
+
*/
|
|
1095
|
+
definitionLists?: DefinitionListSyntax | DeprecatedDialectToggle;
|
|
1096
|
+
/**
|
|
1097
|
+
* `[^id]` footnote references/definitions (`'caret'`), or `'none'` to inline note content as a
|
|
1098
|
+
* parenthetical right at the reference point. Omit to inherit from `extends`. Passing a boolean
|
|
1099
|
+
* is deprecated: `true` = `'caret'`, `false` = `'none'` (removed next major).
|
|
1100
|
+
*/
|
|
1101
|
+
footnotes?: FootnoteSyntax | DeprecatedDialectToggle;
|
|
1102
|
+
/**
|
|
1103
|
+
* Pandoc-style `[@citekey]` citations (`'at'`), or `'none'` to emit `[citekey]` (brackets, no
|
|
1104
|
+
* `@`). Omit to inherit from `extends`. Passing a boolean is deprecated: `true` = `'at'`,
|
|
1105
|
+
* `false` = `'none'` (removed next major).
|
|
1106
|
+
*/
|
|
1107
|
+
citations?: CitationSyntax | DeprecatedDialectToggle;
|
|
1108
|
+
/**
|
|
1109
|
+
* Obsidian-style `[[Page]]`/`[[Page|Alias]]` wikilinks (`'double-bracket'`), or `'none'` to fall
|
|
1110
|
+
* back to a plain `[text](url)` link using the same target. Omit to inherit from `extends`.
|
|
1111
|
+
* Passing a boolean is deprecated: `true` = `'double-bracket'`, `false` = `'none'` (removed next major).
|
|
1112
|
+
*/
|
|
1113
|
+
wikilinks?: WikilinkSyntax | DeprecatedDialectToggle;
|
|
1114
|
+
/** Inline `$...$`/block `$$...$$` math delimiters (`'dollar'`), or `'none'` for bare LaTeX text. */
|
|
1067
1115
|
math?: "dollar" | "none";
|
|
1068
|
-
/**
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1116
|
+
/**
|
|
1117
|
+
* Pandoc-style `{width=50% .centered}` attribute lists after images/tables (`'brace'`), or
|
|
1118
|
+
* `'none'`. Omit to inherit from `extends`. Passing a boolean is deprecated: `true` = `'brace'`,
|
|
1119
|
+
* `false` = `'none'` (removed next major).
|
|
1120
|
+
*/
|
|
1121
|
+
attributeLists?: AttributeListSyntax | DeprecatedDialectToggle;
|
|
1122
|
+
/**
|
|
1123
|
+
* GFM `~~text~~` strikethrough (`'tilde'`; not part of base CommonMark), or `'none'`. Omit to
|
|
1124
|
+
* inherit from `extends`. Passing a boolean is deprecated: `true` = `'tilde'`, `false` = `'none'`
|
|
1125
|
+
* (removed next major).
|
|
1126
|
+
*/
|
|
1127
|
+
strikethrough?: StrikethroughSyntax | DeprecatedDialectToggle;
|
|
1128
|
+
/**
|
|
1129
|
+
* `==text==` highlight (`'equals'`; Obsidian/extended flavors, NOT GFM or CommonMark where `==`
|
|
1130
|
+
* is literal text), or `'none'`. When `'equals'`, a highlighted run round-trips as `==text==`
|
|
1131
|
+
* and `==text==` is read back as a highlight; when `'none'`, a highlight falls back to an HTML
|
|
1132
|
+
* `<mark>`/`<span>` per `fallbackToHtml.inlineFormatting`, and `==text==` stays literal on parse.
|
|
1133
|
+
* Omit to inherit from `extends`.
|
|
1134
|
+
*/
|
|
1135
|
+
highlight?: HighlightSyntax;
|
|
1072
1136
|
/** Unordered list bullet character. */
|
|
1073
1137
|
bulletListMarker?: "-" | "*" | "+";
|
|
1074
1138
|
/** Ordered list marker punctuation. */
|
|
@@ -1098,6 +1162,13 @@ export interface FallbackToHtmlConfig {
|
|
|
1098
1162
|
embeds?: boolean;
|
|
1099
1163
|
/** Multi-line table cell content joined with `<br>` instead of a space. */
|
|
1100
1164
|
cellLineBreaks?: boolean;
|
|
1165
|
+
/**
|
|
1166
|
+
* Multi-paragraph list-item content (an HTML `<li>` with several `<p>` children) joined with
|
|
1167
|
+
* `<br>` instead of a space, so it stays on the item's single Markdown line. Block children of
|
|
1168
|
+
* an item (a code fence or table inside `<li>`) degrade under this join, the same way they do
|
|
1169
|
+
* inside a table cell under `cellLineBreaks`.
|
|
1170
|
+
*/
|
|
1171
|
+
itemLineBreaks?: boolean;
|
|
1101
1172
|
/**
|
|
1102
1173
|
* Inline text color, highlight, and font size via a `<span style="color:...;background-color:...;
|
|
1103
1174
|
* font-size:...">` run, which the Markdown parser reads back. These have no Markdown syntax and
|
|
@@ -1604,6 +1675,12 @@ export interface CellMetadata {
|
|
|
1604
1675
|
* @example 0 for column A, 1 for column B, etc.
|
|
1605
1676
|
*/
|
|
1606
1677
|
col: number;
|
|
1678
|
+
/**
|
|
1679
|
+
* Text alignment for this cell's column, from the GFM pipe-table separator row
|
|
1680
|
+
* (`:---` left, `:---:` center, `---:` right). All cells in a column carry the same value;
|
|
1681
|
+
* the Markdown generator reads it from the header row to emit the separator.
|
|
1682
|
+
*/
|
|
1683
|
+
align?: "left" | "center" | "right";
|
|
1607
1684
|
/**
|
|
1608
1685
|
* The number of rows this cell spans (merges).
|
|
1609
1686
|
* @example 2 if the cell is merged with the one below it.
|
|
@@ -1682,6 +1759,8 @@ export interface ImageMetadata {
|
|
|
1682
1759
|
* @example 'center'
|
|
1683
1760
|
*/
|
|
1684
1761
|
align?: "left" | "center" | "right";
|
|
1762
|
+
/** Advisory image title (Markdown ``, HTML `<img title>`), if any. */
|
|
1763
|
+
title?: string;
|
|
1685
1764
|
}
|
|
1686
1765
|
/**
|
|
1687
1766
|
* Metadata for an embedded external media node (e.g. a YouTube video).
|
|
@@ -1765,6 +1844,8 @@ export interface TextMetadata {
|
|
|
1765
1844
|
* officeParser always parses/generates the syntax.
|
|
1766
1845
|
*/
|
|
1767
1846
|
wikilink?: boolean;
|
|
1847
|
+
/** Advisory link title (Markdown `[text](url "title")`, HTML `<a title>`), if any. */
|
|
1848
|
+
title?: string;
|
|
1768
1849
|
}
|
|
1769
1850
|
/**
|
|
1770
1851
|
* Metadata for note nodes (footnotes/endnotes).
|