Skip to content

Commit

Permalink
make mathml the default
Browse files Browse the repository at this point in the history
Signed-off-by: Michele Dolfi <[email protected]>
  • Loading branch information
dolfim-ibm committed Jan 31, 2025
1 parent eb0cac4 commit 25c6813
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ def save_as_html(
to_element: int = sys.maxsize,
labels: set[DocItemLabel] = DEFAULT_EXPORT_LABELS,
image_mode: ImageRefMode = ImageRefMode.PLACEHOLDER,
formula_to_mathml: bool = False,
formula_to_mathml: bool = True,
page_no: Optional[int] = None,
html_lang: str = "en",
html_head: str = _HTML_DEFAULT_HEAD,
Expand Down Expand Up @@ -2355,7 +2355,7 @@ def export_to_html( # noqa: C901
to_element: int = sys.maxsize,
labels: set[DocItemLabel] = DEFAULT_EXPORT_LABELS,
image_mode: ImageRefMode = ImageRefMode.PLACEHOLDER,
formula_to_mathml: bool = False,
formula_to_mathml: bool = True,
page_no: Optional[int] = None,
html_lang: str = "en",
html_head: str = _HTML_DEFAULT_HEAD,
Expand Down Expand Up @@ -2479,7 +2479,13 @@ def _prepare_tag_content(
annotation.text = math_formula
mathml = unescape(tostring(mathml_element, encoding="unicode"))
text = f"<div>{mathml}</div>"
else:

elif (
item.text == ""
and item.orig != ""
and image_mode == ImageRefMode.EMBEDDED
):

text = f"<pre>{math_formula}</pre>"
html_texts.append(text)

Expand Down

0 comments on commit 25c6813

Please sign in to comment.