Tackling the problem of annotating HTML markup and storing marks in the markup itself, the element came across as a tentative solution. Marking inline:
The fox jumped over the lazy dog.
I want to extend this idea towards marking (highlighting) arbitrary pieces of text in the document. Unfortunately, following this approach to mark, say, across paragraphs, would generate invalid HTML ( expects phrasing content) and possibly break the DOM hierarchy:
Red Green Blue.
Magenta, Cyan,
BlackAlthough a smart parser might translate the above into:
Red Green Blue.
Magenta, Cyan, Black
it doesn't preserve the fact there was a single mark spanning a paragraph and a fragment of a second paragraph, not two marks!
What is the best, possibly semantic way of doing this without breaking the DOM hierarchy? I seek to query this data through DOM/JS APIs.