Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _new_hash(code: str) -> int:
class _RangeTracker:
"""Handles tracking and management of used byte ranges in code."""

def __init__(self):
def __init__(self) -> None:
"""Initialize the range tracker with an empty list of used ranges."""
self.used_ranges: List[Tuple[int, int]] = []

Expand Down
4 changes: 3 additions & 1 deletion docling_core/transforms/serializer/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ def serialize(
text_part = f"{num_hashes * '#'} {text}"
elif isinstance(item, CodeItem):
if params.format_code_blocks:
text_part = f"`{text}`" if is_inline_scope else f"```\n{text}\n```"
# inline items and all hyperlinks: use single backticks
bt = is_inline_scope or (params.include_hyperlinks and item.hyperlink)
text_part = f"`{text}`" if bt else f"```\n{text}\n```"
else:
text_part = text
escape_html = False
Expand Down
6 changes: 3 additions & 3 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -6138,7 +6138,7 @@ def check_version_is_compatible(cls, v: str) -> str:
else:
return CURRENT_VERSION

@model_validator(mode="after") # type: ignore
@model_validator(mode="after")
def validate_document(self) -> Self:
"""validate_document."""
with warnings.catch_warnings():
Expand All @@ -6152,7 +6152,7 @@ def validate_document(self) -> Self:
return self

@model_validator(mode="after")
def validate_misplaced_list_items(self):
def validate_misplaced_list_items(self) -> Self:
"""validate_misplaced_list_items."""
# find list items without list parent, putting succesive ones together
misplaced_list_items: list[list[ListItem]] = []
Expand Down Expand Up @@ -6184,7 +6184,7 @@ def validate_misplaced_list_items(self):
)

# delete list items from document (should not be affected by group addition)
self.delete_items(node_items=curr_list_items)
self.delete_items(node_items=list(curr_list_items))

# add list items to new group
for li in curr_list_items:
Expand Down
Loading
Loading