Skip to content

Unexpected converstion of heading into lists when text starts with numbers #175

@lofcz

Description

@lofcz

Describe the bug
Whenever converting HTML with headings <h1> to <h6> with content starting with a number a bug occurs converting the heading incorrectly, below are some test cases:

<h2>1 Evokace (10 minut)</h2>  <!-- bug 1.1 Evokace (10 minut) -->
<h2>1. Evokace (10 minut)</h2> <!-- bug 1.1 Evokace (10 minut) -->
<h2>1-Evokace (10 minut)</h2> <!-- bug: 1.1 Evokace (10 minut) -->
<h6>22 Evokace (10 minut)</h6> <!-- bug: 1.1.1.1.1.1 Evokace (10 minut) -->
<h2>Evokace 1 (10 minut)</h2> <!-- ok -->

I've used LibreOffice to open the exported document, an example of the <h6> case:
image

Expected behavior
The heading is transformed correctly. This is specific to headings and does not occur with other tags (I've tested <p> and <pre>). I believe the issue lies here:

if (runElement != null && IsNumbering(runElement))
where we use IsNumbering aggressively.

Repro
See the table above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions