markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

Underline not preserved

Open yuyangchee98 opened this issue 1 year ago • 5 comments

I get that there is no syntax for underline in Markdown, but maybe an optional setting for <u> .... </u> ?

yuyangchee98 avatar Dec 15 '24 14:12 yuyangchee98

Can you please provide more context for repro?

gagb avatar Dec 15 '24 19:12 gagb

If the word document contains underlined text, this styling does not show up in the printed result. Image

yuyangchee98 avatar Dec 19 '24 04:12 yuyangchee98

Is there any fix for this?

dutsuwak avatar Jun 11 '25 20:06 dutsuwak

Reproduced on the current PyPI release (markitdown==0.1.7, Python 3.12.13):

  • HTML <u>underlined</u> → underlined
  • Minimal DOCX <w:u w:val="single"/> → underlined

So #35 still affects both HTML and DOCX in 0.1.7. The active PRs above may address DOCX, but regression coverage should include direct HTML as well. A compatible output is inline HTML (<u>underlined</u>) because CommonMark permits raw HTML.

I independently tested this alongside other inline-formatting cases; inconsistent strikethrough preservation is tracked separately in #2340.

cagdasyurekli avatar Aug 25 '26 09:08 cagdasyurekli

I reproduced and reviewed this on current main. An opt-in approach is the safest compatibility boundary: preserve the existing default output, while allowing HTML and DOCX callers to request literal <u>...</u> output.

PR #1672 already implements that design for both HTML and DOCX, so I am not opening another duplicate PR. I independently exercised the important edge cases locally: surrounding whitespace, nested Markdown, empty underline tags, caller-provided Mammoth style-map precedence, constructor configuration, and per-conversion override. The focused selection passed (5 tests; the broader relevant selection passed 14 with 3 optional/environment skips), together with Black and git diff --check.

The main review point I would retain for whichever underline PR is merged is that an injected Mammoth u => u rule must not override a caller's own u => ... style mapping.

cagdasyurekli avatar Aug 26 '26 17:08 cagdasyurekli