diff --git a/pyproject.toml b/pyproject.toml index 64be442..d0d1373 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "openparse" description = "Streamlines the process of preparing documents for LLM's." readme = "README.md" requires-python = ">=3.8" -version = "0.5.3" +version = "0.5.4" authors = [{name = "Sergey Filimonov", email = "hello@sergey.fyi"}] dependencies = [ "PyMuPDF >= 1.23.2", diff --git a/src/openparse/tables/pymupdf/parse.py b/src/openparse/tables/pymupdf/parse.py index b8699bf..95cd2d9 100644 --- a/src/openparse/tables/pymupdf/parse.py +++ b/src/openparse/tables/pymupdf/parse.py @@ -22,11 +22,19 @@ def output_to_html(headers: List[str], rows: List[List[str]]) -> str: def output_to_markdown(headers: List[str], rows: List[List[str]]) -> str: - markdown_output = "| " + " | ".join(headers) + " |\n" + markdown_output = "" + if headers is not None: + for header in headers: + safe_header = "" if header is None else header + markdown_output += "| " + safe_header + " " + + markdown_output += "|\n" markdown_output += "|---" * len(headers) + "|\n" for row in rows: - processed_row = [" " if cell in [None, ""] else cell.replace("\n", " ") for cell in row] + processed_row = [ + " " if cell in [None, ""] else cell.replace("\n", " ") for cell in row + ] markdown_output += "| " + " | ".join(processed_row) + " |\n" return markdown_output diff --git a/src/openparse/version.py b/src/openparse/version.py index 98a90a8..e894b5d 100644 --- a/src/openparse/version.py +++ b/src/openparse/version.py @@ -1,4 +1,4 @@ -OPEN_PARSE_VERSION = "0.5.3" +OPEN_PARSE_VERSION = "0.5.4" def version_info() -> str: