Lets say I have the following markup:
<html> <head> <title>Page Title</title> </head> <body> <h1>Some title</h1> <p>First paragraph</p> <p>Second paragraph</p> </body> <html> I need to mark some parts of the text, namely "irst paragraph secon" It would look something like this:
<html> <head> <title>Page Title</title> </head> <body> <h1>Some title</h1> <p>F <mark> irst paragraph</p><p>Secon </mark> d paragraph</p> </body> <html> But the problem is be the html markup would be broken. The more complex the markup, the more problems this approach would have.
Question:
Looking for ideas on how can I take the first HTML example and apply a function to return a html structure where "irst paragraph second" is specifically marked somehow.
What I currently have is:
- the parent container of the string "First paragraph"
- the text "irst paragraph second"
- the offset of the text "irst" in "First paragraph"