Skip to content

Commit

Permalink
Handle block equations
Browse files Browse the repository at this point in the history
  • Loading branch information
rateixei committed Jan 29, 2025
1 parent 4f31f86 commit feb93f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -2208,7 +2208,8 @@ def escape_underscores(text):
"""Escape underscores but leave them intact in the URL.."""
# Firstly, identify all the URL patterns.
url_pattern = r"!\[.*?\]\((.*?)\)"
latex_pattern = r"\$(?:\\.|[^$\\])*\$"
# Matches both inline ($...$) and block ($$...$$) LaTeX equations:
latex_pattern = r"\$\$?(?:\\.|[^$\\])*\$\$?"
combined_pattern = f"({url_pattern})|({latex_pattern})"

parts = []
Expand Down

0 comments on commit feb93f3

Please sign in to comment.