anytomd 1.2.1 → 1.3.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 CHANGED
@@ -252,9 +252,19 @@ anytomd --plain-text document.docx
252
252
  # Plain text from stdin
253
253
  echo "Name,Age" | anytomd --format csv --plain-text
254
254
 
255
- # Auto image descriptions (just set GEMINI_API_KEY)
255
+ # Extract comments (DOCX/PPTX) into an appended Comments section
256
+ anytomd --extract-comments document.docx
257
+
258
+ # Image descriptions via Gemini (requires GEMINI_API_KEY env var)
256
259
  export GEMINI_API_KEY=your-key
257
- anytomd presentation.pptx
260
+ anytomd --gemini presentation.pptx
261
+
262
+ # Use a specific Gemini model
263
+ anytomd --gemini --gemini-model gemini-2.5-flash-lite presentation.pptx
264
+
265
+ # Resource limits (defaults: 8GiB input, 4GiB images, 16GiB zip)
266
+ anytomd --max-input-size 500MB document.docx
267
+ anytomd --max-zip-size 2GiB archive.xlsx
258
268
  ```
259
269
 
260
270
  ### Exit Codes
@@ -313,6 +323,47 @@ for (filename, bytes) in &result.images {
313
323
  }
314
324
  ```
315
325
 
326
+ ### Extracting Comments (DOCX / PPTX)
327
+
328
+ Setting `extract_comments` appends a `# Comments` section to the end of the
329
+ output (both Markdown and plain text). Each comment records the commenter, the
330
+ comment body, and the source — the commented-on text for DOCX, or the slide
331
+ label for PPTX (whose comments are anchored to a point, not a text span).
332
+ Replies are flattened and marked `(reply)`; the flag is a no-op for other
333
+ formats.
334
+
335
+ ```rust
336
+ use anytomd::{convert_file, ConversionOptions};
337
+
338
+ let options = ConversionOptions {
339
+ extract_comments: true,
340
+ ..Default::default()
341
+ };
342
+ let result = convert_file("document.docx", &options).unwrap();
343
+ println!("{}", result.markdown);
344
+ ```
345
+
346
+ Example appended section:
347
+
348
+ ```markdown
349
+ # Comments
350
+
351
+ ## 1
352
+ - **author**: Jane Smith (2024-01-15T09:30:00Z)
353
+ - **comment**: Please revise this paragraph.
354
+ - **source**: the quick brown fox
355
+ ```
356
+
357
+ Notes:
358
+
359
+ - **DOCX:** commenter identity comes from the comment author and date; the
360
+ source is the commented-on text (collapsed to one line, capped at 200
361
+ characters). Ranges in the body, headers, footers, footnotes, and endnotes
362
+ are all scanned. Threaded replies are detected via `commentsExtended.xml`.
363
+ - **PPTX:** both the legacy (`commentAuthors.xml`) and modern
364
+ (`authors.xml` / threaded) comment schemes are supported. The source is the
365
+ slide label (e.g. `Slide 2: Quarterly Results`).
366
+
316
367
  ### LLM-Based Image Descriptions
317
368
 
318
369
  anytomd can generate alt text for images using any LLM backend via the `ImageDescriber` trait. A built-in Google Gemini implementation is included.
@@ -431,6 +482,7 @@ pub async fn convert_bytes_async(
431
482
  | Field | Type | Default | Description |
432
483
  |-------|------|---------|-------------|
433
484
  | `extract_images` | `bool` | `false` | Extract embedded images into `result.images` |
485
+ | `extract_comments` | `bool` | `false` | Append a `# Comments` section (DOCX/PPTX only) |
434
486
  | `max_total_image_bytes` | `usize` | 50 MB | Hard cap for total extracted image bytes |
435
487
  | `max_input_bytes` | `usize` | 100 MB | Maximum input file size |
436
488
  | `max_uncompressed_zip_bytes` | `usize` | 500 MB | ZIP bomb guard |
package/anytomd_bg.js CHANGED
@@ -216,7 +216,7 @@ export function __wbg_new_typed_893dbec5fe999814(arg0, arg1) {
216
216
  const a = state0.a;
217
217
  state0.a = 0;
218
218
  try {
219
- return wasm_bindgen__convert__closures_____invoke__h2deb7db8ea6922c5(a, state0.b, arg0, arg1);
219
+ return wasm_bindgen__convert__closures_____invoke__h7494129768ec66af(a, state0.b, arg0, arg1);
220
220
  } finally {
221
221
  state0.a = a;
222
222
  }
@@ -335,13 +335,13 @@ export function __wbg_value_414b42ce7b3eca22(arg0) {
335
335
  return ret;
336
336
  }
337
337
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
338
- // Cast intrinsic for `Closure(Closure { dtor_idx: 180, function: Function { arguments: [], shim_idx: 181, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
339
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h5f81f6b11f600e0f, wasm_bindgen__convert__closures_____invoke__hf70767533d8a8a0d);
338
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 186, function: Function { arguments: [], shim_idx: 187, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
339
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h850abdac2a8bb899, wasm_bindgen__convert__closures_____invoke__hb3e5b98b70c862a0);
340
340
  return ret;
341
341
  }
342
342
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
343
- // Cast intrinsic for `Closure(Closure { dtor_idx: 205, function: Function { arguments: [Externref], shim_idx: 206, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
344
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hc635dc0582188d21, wasm_bindgen__convert__closures_____invoke__h889c317fc30b5049);
343
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 210, function: Function { arguments: [Externref], shim_idx: 211, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
344
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h173270a6c0ad11e0, wasm_bindgen__convert__closures_____invoke__hbd82b7fcffec40e2);
345
345
  return ret;
346
346
  }
347
347
  export function __wbindgen_cast_0000000000000003(arg0, arg1) {
@@ -358,19 +358,19 @@ export function __wbindgen_init_externref_table() {
358
358
  table.set(offset + 2, true);
359
359
  table.set(offset + 3, false);
360
360
  }
361
- function wasm_bindgen__convert__closures_____invoke__hf70767533d8a8a0d(arg0, arg1) {
362
- wasm.wasm_bindgen__convert__closures_____invoke__hf70767533d8a8a0d(arg0, arg1);
361
+ function wasm_bindgen__convert__closures_____invoke__hb3e5b98b70c862a0(arg0, arg1) {
362
+ wasm.wasm_bindgen__convert__closures_____invoke__hb3e5b98b70c862a0(arg0, arg1);
363
363
  }
364
364
 
365
- function wasm_bindgen__convert__closures_____invoke__h889c317fc30b5049(arg0, arg1, arg2) {
366
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h889c317fc30b5049(arg0, arg1, arg2);
365
+ function wasm_bindgen__convert__closures_____invoke__hbd82b7fcffec40e2(arg0, arg1, arg2) {
366
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hbd82b7fcffec40e2(arg0, arg1, arg2);
367
367
  if (ret[1]) {
368
368
  throw takeFromExternrefTable0(ret[0]);
369
369
  }
370
370
  }
371
371
 
372
- function wasm_bindgen__convert__closures_____invoke__h2deb7db8ea6922c5(arg0, arg1, arg2, arg3) {
373
- wasm.wasm_bindgen__convert__closures_____invoke__h2deb7db8ea6922c5(arg0, arg1, arg2, arg3);
372
+ function wasm_bindgen__convert__closures_____invoke__h7494129768ec66af(arg0, arg1, arg2, arg3) {
373
+ wasm.wasm_bindgen__convert__closures_____invoke__h7494129768ec66af(arg0, arg1, arg2, arg3);
374
374
  }
375
375
 
376
376
 
package/anytomd_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "anytomd",
3
3
  "type": "module",
4
4
  "description": "Pure Rust library that converts various document formats into Markdown",
5
- "version": "1.2.1",
5
+ "version": "1.3.0",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",