Skip to content

Commit

Permalink
cleaned arg names, expanded docstring
Browse files Browse the repository at this point in the history
Signed-off-by: Panos Vagenas <[email protected]>
  • Loading branch information
vagenas committed Jul 18, 2024
1 parent 8c3afc6 commit 5e6bba1
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,32 @@ def _resolve_ref(self, item: Ref) -> Optional[Table]:

def export_to_markdown(
self,
sep: str = "\n\n",
start_incl: int = 0,
end_excl: Optional[int] = None,
delim: str = "\n\n",
main_text_start: int = 0,
main_text_stop: Optional[int] = None,
) -> str:
"""Return a Markdown serialization of the document."""
r"""Serialize to Markdown.
Operates on a slice of the document's main_text as defined through arguments
main_text_start and main_text_stop; defaulting to the whole main_text.
Args:
delim (str, optional): Delimiter to use when concatenating the various
Markdown parts. Defaults to "\n\n".
main_text_start (int, optional): Main-text slicing start index (inclusive).
Defaults to 0.
main_text_end (Optional[int], optional): Main-text slicing stop index
(exclusive). Defaults to None.
Returns:
str: The exported Markdown representation.
"""
has_title = False
prev_text = ""
md_texts: list[str] = []

if self.main_text is not None:
for orig_item in self.main_text[start_incl:end_excl]:
for orig_item in self.main_text[main_text_start:main_text_stop]:
markdown_text = ""

item = (
Expand Down Expand Up @@ -483,5 +498,5 @@ def export_to_markdown(
if markdown_text:
md_texts.append(markdown_text)

result = sep.join(md_texts)
result = delim.join(md_texts)
return result

0 comments on commit 5e6bba1

Please sign in to comment.