fix: add divider row to markdown tables with auto-generated integer headers#95
Open
vibeyclaw wants to merge 1 commit intoalphanome-ai:mainfrom
Open
fix: add divider row to markdown tables with auto-generated integer headers#95vibeyclaw wants to merge 1 commit intoalphanome-ai:mainfrom
vibeyclaw wants to merge 1 commit intoalphanome-ai:mainfrom
Conversation
…eaders When an HTML table has no semantic <thead>, pandas auto-assigns integer column names (0, 1, 2, ...). The previous code stripped both the integer header row and the separator row, producing invalid Markdown (no divider). Fix: after stripping the integer header row, treat the first data row as the visual header and insert a generated '---' divider beneath it, so the output is always a valid GitHub-Flavored Markdown table. Fixes alphanome-ai#90
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.
Problem
Fixes #90
When an HTML table has no semantic
<thead>,pd.read_html()assigns integer column names (0, 1, 2, ...). The previous code stripped both the integer header row and the separator row, producing output like:This is invalid Markdown — no divider row means the table is not rendered as a proper table in GitHub, Obsidian, or other Markdown renderers.
Fix
After stripping the auto-generated integer headers, promote the first data row to serve as the visual header and insert a generated
---divider beneath it:The
elifbranch (for tables with meaningful column names) is unchanged — those already produce a valid divider.Root Cause
Many SEC filing tables use
<td>for both header and data rows without a<thead>element, so pandas cannot distinguish the visual header from data. The fix preserves the original intent of stripping integer placeholders while ensuring the output is always valid Markdown.