Repository navigation
Conversation
format_table_body renders list-shaped table_data as a Markdown table for prompts and chunks. An empty cell (None) was written as "None", a pipe inside a cell started a new column, a line break inside a cell ended the row, and a row shorter than the header shifted nothing into place but left the table ragged. Cells are now rendered by _table_cell: None is empty, a pipe is escaped, a line break is a space, and short rows are padded to the widest row.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
format_table_bodyturns list-shapedtable_datainto the Markdown table that goes into the table prompt (query.py,modalprocessors.py) and the table chunk (processor.py). That is the shape non-MinerU parsers andinsert_content_listcallers pass. It joinedstr(cell)with" | ", so four ordinary cell values broke the table:None) read as the word "None".lines |became a stray line.Related Issues
None found. The list-of-lists rendering came with the content-list alias handling.
Changes Made
raganything/utils.py: a new_table_cellrenders each cell.Nonebecomes empty,|becomes\|, and a line break becomes a space.format_table_bodynow pads every row to the widest row. String table bodies and other shapes are unchanged.tests/test_content_list_alias_handling.py:test_table_rows_keep_their_cellsuses the table above. The existing[["A", "B"], ["C", "D"]]assertion still holds.Checklist
Additional Notes
mainand passes here. Fullpytest tests/on Python 3.12: 899 passed.pre-commit run(ruff-format, ruff, whitespace hooks) on both files: all hooks pass.test_content_list_alias_handling.pycannot be run on its own onmain. Its stub forraganything.parserhas noHTML_FILE_EXTENSIONS, whichprocessor.pyimports since fix(parser): require Docling for HTML instead of converting it with LibreOffice #418. The stub is only installed when nothing imported the real module first, so the full suite passes and CI stays green. I left that alone here.