Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Text indices of formatting elements do not get parsed correctly when inside implicit paragraphs. #2099

Open
hansjovis opened this issue Jan 17, 2019 · 0 comments

Comments

@hansjovis
Copy link
Contributor

This HTML source text:

<strong>Some text</strong>

Gets parsed to this:

Result of parsing above source code:
{
      "type": "StructuredNode",
      "sourceStartIndex": 0,
      "sourceEndIndex": 26,
      "tag": "root",
      "children": [
        {
          "type": "Paragraph",
          "sourceStartIndex": 0,
          "sourceEndIndex": 26,
          "textContainer": {
            "text": "Some text",
            "formatting": [
              {
                "type": "strong",
                "attributes": null,
                "sourceStartIndex": 0,
                "sourceEndIndex": 26,
                "textStartIndex": -8,  // <= This is wrong.
                "textEndIndex": 1 // <= This too.
              }
            ]
          },
          "tag": ""
        }
      ]
    }

The text source start and end indices are wrong.
It happens with all formatting elements, specifically in "implicit" paragraphs (without explicit p-tags).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant