feat: support TSV/other delimiters and fix Markdown table collisions#2061
Open
trippinganymess wants to merge 5 commits into
Open
feat: support TSV/other delimiters and fix Markdown table collisions#2061trippinganymess wants to merge 5 commits into
trippinganymess wants to merge 5 commits into
Conversation
…ssv, .psv) Refactored the to extend it's capabilities to resolve .tsv, .psv, .ssv files into markdown. The implementation now give user the overriding power to specify the delimiter used in the file, if the dilimiter is not specified then a sniffer function is used to determine the delimiter, In case that fails and result into csv.Error then we fallback to check the extension and MIMETYPE to determine the delimiter
…e, carriage return character This is applied iteratively during row construction to prevent Markdown layout collisions without spiking heap memory.
Author
|
@microsoft-github-policy-service agree |
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 Statement
The current CSV converter lacks support for alternative delimiter formats (like
.tsv,.psv,.ssv) and fails to safely escape structural characters (like pipes and newlines) within cell data, leading to corrupted Markdown table rendering.Proposed Solution
kwargs.csv.Sniffer()to dynamically determine the internal delimiter from the file content (handling edge cases where internal data doesn't match the file extension).csv.Error), it safely falls back to a generic delimiter based on the file's extension or MIME type.text/tsveven though it is not in the official IANA list because many legacy system still use itFixed a small text duplication in the documentation of
_base_converter.py.resolves #2019 and #2022