Skip to content

중첩 테이블 html 은 codeitem으로 저장하도록 수정#156

Merged
inoray merged 1 commit intodevelopfrom
feature/155-nested-table-html
Jan 30, 2026
Merged

중첩 테이블 html 은 codeitem으로 저장하도록 수정#156
inoray merged 1 commit intodevelopfrom
feature/155-nested-table-html

Conversation

@inoray
Copy link
Collaborator

@inoray inoray commented Jan 30, 2026

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

@inoray inoray linked an issue Jan 30, 2026 that may be closed by this pull request
@gemini-code-assist
Copy link

Summary of Changes

Hello @inoray, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 html_backend의 테이블 처리 로직을 개선합니다. 기존에는 중첩된 테이블이 원본 HTML 구조를 유지하지 못했을 수 있습니다. 이제 복잡한 테이블 레이아웃의 충실도를 보장하기 위해, 감지된 모든 중첩 테이블은 문서 구조 내에서 원본 HTML 코드 블록으로 캡처됩니다. 이 변경 사항은 복잡한 HTML 콘텐츠의 표현을 향상시킵니다.

Highlights

  • 중첩 테이블 처리 개선: docling/backend/html_backend.py 파일의 handle_table 함수에서 중첩된 HTML 테이블을 발견할 경우, 해당 테이블의 원본 HTML을 Docling 문서에 코드 블록(codeitem)으로 저장하도록 로직이 추가되었습니다. 이는 복잡한 테이블 구조의 원본 형태를 유지하기 위함입니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@inoray inoray requested a review from JaeseungYang January 30, 2026 04:05
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR improves how the HTML parser handles nested tables by storing previously skipped tables as raw HTML code items to prevent data loss. However, capturing the raw HTML string introduces a Cross-Site Scripting (XSS) risk, which is inconsistent with the backend's usual practice of stripping HTML tags to extract text content. It is recommended to extract text content safely to maintain security and consistency. Additionally, there is a suggestion regarding the charspan value of the generated ProvenanceItem.

Comment on lines +555 to +560
original_html = str(element)

# 코드 아이템으로 추가하여 HTML 형식 유지
doc.add_code(
parent=self.parents[self.level],
text=original_html,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

The use of str(element) to capture the raw HTML of a nested table and store it in a CodeItem introduces a potential Cross-Site Scripting (XSS) vulnerability. Unlike other handlers in this class that use .text or .get_text() to extract only the text content and strip HTML tags, this approach preserves all HTML tags, including potentially malicious ones like <script>, <iframe>, or event handlers (e.g., onerror). If the resulting document is exported and rendered in a web environment without proper sanitization, these scripts could be executed in the user's browser. To remediate this, you should extract only the text content or ensure the HTML is properly sanitized or escaped before being stored in the document model.

Suggested change
original_html = str(element)
# 코드 아이템으로 추가하여 HTML 형식 유지
doc.add_code(
parent=self.parents[self.level],
text=original_html,
text_content = element.get_text(strip=True)
# 코드 아이템으로 추가하여 HTML 형식 유지
doc.add_code(
parent=self.parents[self.level],
text=text_content,

prov=ProvenanceItem(
page_no=1,
bbox=BoundingBox(l=0, t=0, r=1, b=1),
charspan=(0, len(original_html))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

charspan(0, len(original_html))로 설정하셨는데, 이는 잠재적으로 부정확한 정보를 제공할 수 있습니다. charspan은 보통 원본 문서에서의 문자 위치를 나타냅니다. 하지만 str(element)로 생성된 HTML 문자열은 원본과 공백, 속성 순서 등에서 차이가 있을 수 있어 len(original_html)이 원본에서의 실제 길이와 다를 수 있습니다.

이 파일의 다른 부분에서는 charspan(0, 0)으로 설정하여 위치 정보를 알 수 없음을 나타내고 있습니다. 일관성을 유지하고 오해의 소지를 없애기 위해 여기에서도 charspan=(0, 0)으로 설정하는 것을 제안합니다.

Suggested change
charspan=(0, len(original_html))
charspan=(0, 0)

@inoray inoray merged commit d90b2b0 into develop Jan 30, 2026
2 checks passed
@inoray inoray deleted the feature/155-nested-table-html branch January 30, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

중첩 테이블 html 코드 처리기능 추가

2 participants