odf-kit 0.9.4 → 0.9.5

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/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { HeaderFooterBuilder } from "./odt/index.js";
4
4
  export { TableBuilder, RowBuilder, CellBuilder } from "./odt/index.js";
5
5
  export { ListBuilder } from "./odt/index.js";
6
6
  export { htmlToOdt } from "./odt/index.js";
7
+ export { markdownToOdt } from "./odt/index.js";
7
8
  export type { ContentElement, TextFormatting, TextRun, TableOptions, CellOptions, PageLayout, ParagraphOptions, TabStop, ListOptions, ImageOptions, ImageData, HtmlToOdtOptions, } from "./odt/index.js";
8
9
  export type { MetadataOptions } from "./core/index.js";
9
10
  export { fillTemplate, healPlaceholders, replaceAll } from "./template/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EACV,cAAc,EACd,cAAc,EACd,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;A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,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export { HeaderFooterBuilder } from "./odt/index.js";
6
6
  export { TableBuilder, RowBuilder, CellBuilder } from "./odt/index.js";
7
7
  export { ListBuilder } from "./odt/index.js";
8
8
  export { htmlToOdt } from "./odt/index.js";
9
+ export { markdownToOdt } from "./odt/index.js";
9
10
  export { fillTemplate, healPlaceholders, replaceAll } from "./template/index.js";
10
11
  export { OdsDocument } from "./ods/index.js";
11
12
  export { OdsSheet } from "./ods/index.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,2CAA2C;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAgB3C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,2CAA2C;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgB/C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
@@ -4,6 +4,7 @@ export { HeaderFooterBuilder } from "./header-footer-builder.js";
4
4
  export { TableBuilder, RowBuilder, CellBuilder } from "./table-builder.js";
5
5
  export { ListBuilder } from "./list-builder.js";
6
6
  export { htmlToOdt } from "./html-to-odt.js";
7
+ export { markdownToOdt } from "./markdown-to-odt.js";
7
8
  export type { ContentElement } from "./content.js";
8
9
  export type { HtmlToOdtOptions } from "./html-to-odt.js";
9
10
  export type { TextFormatting, TextRun, TableOptions, CellOptions, PageLayout, ParagraphOptions, TabStop, ListOptions, ImageOptions, ImageData, } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/odt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EACV,cAAc,EACd,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,GACV,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/odt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EACV,cAAc,EACd,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,GACV,MAAM,YAAY,CAAC"}
package/dist/odt/index.js CHANGED
@@ -4,4 +4,5 @@ export { HeaderFooterBuilder } from "./header-footer-builder.js";
4
4
  export { TableBuilder, RowBuilder, CellBuilder } from "./table-builder.js";
5
5
  export { ListBuilder } from "./list-builder.js";
6
6
  export { htmlToOdt } from "./html-to-odt.js";
7
+ export { markdownToOdt } from "./markdown-to-odt.js";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/odt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/odt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { HtmlToOdtOptions } from "./html-to-odt.js";
2
+ /**
3
+ * Convert a Markdown string to an ODT file.
4
+ *
5
+ * Internally converts Markdown → HTML via `marked`, then HTML → ODT
6
+ * via {@link htmlToOdt}. All {@link HtmlToOdtOptions} apply — page format,
7
+ * orientation, margins, and metadata.
8
+ *
9
+ * **Supported Markdown:** CommonMark spec — headings, paragraphs, bold,
10
+ * italic, strikethrough, unordered and ordered lists, nested lists, tables,
11
+ * blockquotes, fenced code blocks, inline code, horizontal rules, and links.
12
+ *
13
+ * **Page format:** Defaults to A4, the ISO standard for Europe and most of
14
+ * the world. Pass `{ pageFormat: "letter" }` for US/Canadian users.
15
+ *
16
+ * @param markdown - Markdown string to convert.
17
+ * @param options - Optional page format, margins, orientation, and metadata.
18
+ * @returns Promise resolving to a valid `.odt` file as a `Uint8Array`.
19
+ *
20
+ * @example
21
+ * // Basic usage — A4 page (default)
22
+ * import { markdownToOdt } from "odf-kit";
23
+ * const bytes = await markdownToOdt("# Hello\n\nWorld");
24
+ *
25
+ * @example
26
+ * // US letter with metadata
27
+ * const bytes = await markdownToOdt(markdownString, {
28
+ * pageFormat: "letter",
29
+ * metadata: { title: "My Document", creator: "Alice" },
30
+ * });
31
+ */
32
+ export declare function markdownToOdt(markdown: string, options?: HtmlToOdtOptions): Promise<Uint8Array>;
33
+ //# sourceMappingURL=markdown-to-odt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-to-odt.d.ts","sourceRoot":"","sources":["../../src/odt/markdown-to-odt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,UAAU,CAAC,CAGrB"}
@@ -0,0 +1,37 @@
1
+ import { marked } from "marked";
2
+ import { htmlToOdt } from "./html-to-odt.js";
3
+ /**
4
+ * Convert a Markdown string to an ODT file.
5
+ *
6
+ * Internally converts Markdown → HTML via `marked`, then HTML → ODT
7
+ * via {@link htmlToOdt}. All {@link HtmlToOdtOptions} apply — page format,
8
+ * orientation, margins, and metadata.
9
+ *
10
+ * **Supported Markdown:** CommonMark spec — headings, paragraphs, bold,
11
+ * italic, strikethrough, unordered and ordered lists, nested lists, tables,
12
+ * blockquotes, fenced code blocks, inline code, horizontal rules, and links.
13
+ *
14
+ * **Page format:** Defaults to A4, the ISO standard for Europe and most of
15
+ * the world. Pass `{ pageFormat: "letter" }` for US/Canadian users.
16
+ *
17
+ * @param markdown - Markdown string to convert.
18
+ * @param options - Optional page format, margins, orientation, and metadata.
19
+ * @returns Promise resolving to a valid `.odt` file as a `Uint8Array`.
20
+ *
21
+ * @example
22
+ * // Basic usage — A4 page (default)
23
+ * import { markdownToOdt } from "odf-kit";
24
+ * const bytes = await markdownToOdt("# Hello\n\nWorld");
25
+ *
26
+ * @example
27
+ * // US letter with metadata
28
+ * const bytes = await markdownToOdt(markdownString, {
29
+ * pageFormat: "letter",
30
+ * metadata: { title: "My Document", creator: "Alice" },
31
+ * });
32
+ */
33
+ export async function markdownToOdt(markdown, options) {
34
+ const html = await marked.parse(markdown);
35
+ return htmlToOdt(html, options);
36
+ }
37
+ //# sourceMappingURL=markdown-to-odt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-to-odt.js","sourceRoot":"","sources":["../../src/odt/markdown-to-odt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,OAA0B;IAE1B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odf-kit",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "Generate, fill, read, and convert OpenDocument Format (.odt) files in JavaScript and TypeScript. Works in Node.js and browsers.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -66,7 +66,8 @@
66
66
  "url": "git+https://github.com/GitHubNewbie0/odf-kit.git"
67
67
  },
68
68
  "dependencies": {
69
- "fflate": "^0.8.2"
69
+ "fflate": "^0.8.2",
70
+ "marked": "^18.0.0"
70
71
  },
71
72
  "devDependencies": {
72
73
  "@eslint/js": "^9.18.0",