Skip to content

feat: Support rich table cell content #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
per-file-ignores = __init__.py:F401
max-line-length = 88
max-line-length = 120
exclude = test/*
max-complexity = 25
docstring-convention = google
Expand Down
3 changes: 3 additions & 0 deletions docling_core/transforms/serializer/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ def serialize(
continue

content = html.escape(cell.text.strip())
if cell.has_rich_content():
cell_parts = doc_serializer.get_parts(item=cell)
content += "\n" + "\n".join([part.text for part in cell_parts])
celltag = "td"
if cell.column_header:
celltag = "th"
Expand Down
2 changes: 1 addition & 1 deletion docling_core/types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from docling_core.utils.validators import validate_datetime, validate_unique_list

# (subset of) JSON Pointer URI fragment id format, e.g. "#/main-text/84":
_JSON_POINTER_REGEX: Final[str] = r"^#(?:/([\w-]+)(?:/(\d+))?)?$"
_JSON_POINTER_REGEX: Final[str] = r"^(?:#|\d+(?:#)?)(?:/(?:[\w-]+|\d+))*$"

LanguageT = TypeVar("LanguageT", bound=str)
IdentifierTypeT = TypeVar("IdentifierTypeT", bound=str)
Expand Down
Loading