Skip to content

Commit

Permalink
Fix whitespace inside tags
Browse files Browse the repository at this point in the history
  • Loading branch information
VikParuchuri committed Jan 15, 2025
1 parent 81fd95e commit 82b97ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions marker/renderers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ def merge_consecutive_tags(html, tag):
return html

def replace_whitespace(match):
return match.group(1)
whitespace = match.group(1)
if len(whitespace) == 0:
return ""
else:
return " "

pattern = fr'</{tag}>(\s*)<{tag}>'

Expand All @@ -57,9 +61,6 @@ def replace_whitespace(match):
break
html = new_merged

# Replace consecutive whitespace
html = re.sub(r'\s+', ' ', html)

return html

def generate_page_stats(self, document: Document, document_output):
Expand Down

0 comments on commit 82b97ca

Please sign in to comment.