docling-core 1.5.0__py3-none-any.whl → 1.6.0__py3-none-any.whl

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.

Potentially problematic release.


This version of docling-core might be problematic. Click here for more details.

@@ -434,7 +434,7 @@ class ExportedCCSDocument(
434
434
 
435
435
  return pagedims
436
436
 
437
- def export_to_markdown(
437
+ def export_to_markdown( # noqa: C901
438
438
  self,
439
439
  delim: str = "\n\n",
440
440
  main_text_start: int = 0,
@@ -445,8 +445,10 @@ class ExportedCCSDocument(
445
445
  "paragraph",
446
446
  "caption",
447
447
  "table",
448
+ "figure",
448
449
  ],
449
450
  strict_text: bool = False,
451
+ image_placeholder: str = "<!-- image -->",
450
452
  ) -> str:
451
453
  r"""Serialize to Markdown.
452
454
 
@@ -460,6 +462,12 @@ class ExportedCCSDocument(
460
462
  Defaults to 0.
461
463
  main_text_end (Optional[int], optional): Main-text slicing stop index
462
464
  (exclusive). Defaults to None.
465
+ main_text_labels (list[str], optional): The labels to include in the
466
+ markdown.
467
+ strict_text (bool, optional): if true, the output will be only plain text
468
+ without any markdown styling. Defaults to False.
469
+ image_placeholder (str, optional): the placeholder to include to position
470
+ images in the markdown. Defaults to a markdown comment "<!-- image -->".
463
471
 
464
472
  Returns:
465
473
  str: The exported Markdown representation.
@@ -539,6 +547,14 @@ class ExportedCCSDocument(
539
547
 
540
548
  markdown_text = md_table
541
549
 
550
+ elif isinstance(item, Figure) and item_type in main_text_labels:
551
+
552
+ markdown_text = ""
553
+ if not strict_text:
554
+ markdown_text = f"{image_placeholder}"
555
+ if item.text:
556
+ markdown_text += "\n" + item.text
557
+
542
558
  if markdown_text:
543
559
  md_texts.append(markdown_text)
544
560
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: docling-core
3
- Version: 1.5.0
3
+ Version: 1.6.0
4
4
  Summary: A python library to define and validate data types in Docling.
5
5
  Home-page: https://ds4sd.github.io/
6
6
  License: MIT
@@ -24,7 +24,7 @@ docling_core/types/doc/base.py,sha256=QQC8KzQeYWnHFPY2_BNGcbTp6J2_rPbnLjsnbehICn
24
24
  docling_core/types/doc/doc_ann.py,sha256=8pV2efUglw19jxl4_oqB__mSxjWvtGIcllyCdqA-b2s,1196
25
25
  docling_core/types/doc/doc_ocr.py,sha256=6PC0C-OczF-MyfgRxEI1xs3PWgNOzi7i2yEQbTqZz0I,1387
26
26
  docling_core/types/doc/doc_raw.py,sha256=Y69G6IiauNDaoT-5el4xo1ypWpnBJQ75akGGkCMTZSc,3888
27
- docling_core/types/doc/document.py,sha256=FdAAyYfYnKXi3kqt0Qk2NYFAxsuGbHsNVB1EDIRVH3Y,22136
27
+ docling_core/types/doc/document.py,sha256=qTVgmDX1geSRucJJeSV1G_sNjs6hL-kqns8rulbpyGw,22973
28
28
  docling_core/types/doc/tokens.py,sha256=uU_MYW_p7ypf7eYICFBvxdnVaPZ7CQnvZmbJ6oPrtEA,6134
29
29
  docling_core/types/gen/__init__.py,sha256=C6TuCfvpSnSL5XDOFMcYHUY2-i08vvfOGRcdu6Af0pI,124
30
30
  docling_core/types/gen/generic.py,sha256=l4CZ4_Lb8ONG36WNJWbKX5hGKvTh_yU-hXp5hsm7uVU,844
@@ -45,8 +45,8 @@ docling_core/utils/ds_generate_jsonschema.py,sha256=EhNQutqWJFWuN-yl9UUPFZ7DJTvG
45
45
  docling_core/utils/file.py,sha256=VQgzjyvmJnAIHB6ex7ikcmbDAR4GA1ALreuO7Ubrp50,1895
46
46
  docling_core/utils/validate.py,sha256=3FmnxnKTDZC5J9OGxCL3U3DGRl0t0bBV1NcySXswdas,2031
47
47
  docling_core/utils/validators.py,sha256=fBdyWX4PvFh7o_d25ZTs4iwmeo75QTbrxsvXv2kXkTg,2777
48
- docling_core-1.5.0.dist-info/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
49
- docling_core-1.5.0.dist-info/METADATA,sha256=Z5kzVlogRs8FQN_ummLsikFOrf9BBr-rR-ESfwLvwHs,5432
50
- docling_core-1.5.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
51
- docling_core-1.5.0.dist-info/entry_points.txt,sha256=XHhtJEkdUuLxXSNxLdFIzx_siQ3z2UFQEKp-P8VYAE4,189
52
- docling_core-1.5.0.dist-info/RECORD,,
48
+ docling_core-1.6.0.dist-info/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
49
+ docling_core-1.6.0.dist-info/METADATA,sha256=abvLZVwlah9skNgFUQa2Fy6c5QKaUAvzEV2rZ2dDVQ8,5432
50
+ docling_core-1.6.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
51
+ docling_core-1.6.0.dist-info/entry_points.txt,sha256=XHhtJEkdUuLxXSNxLdFIzx_siQ3z2UFQEKp-P8VYAE4,189
52
+ docling_core-1.6.0.dist-info/RECORD,,