You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've used HtmlSanitizer as the basis for injecting links to keywords in content. Basically, when a TextToken comes up, it looks for keywords in the value and wraps a link around the keyword.
Unfortunately I don't think this is the right approach, as it seems to mess up the parent nodes somehow.
<ul><liTitleHere><br><spanThisisatestresult<ahref="/search?q=foo">foo</a><ahref="/search?q=bar">bar</a> is also here....></span></li></ul>
<ul><li>Title Here <br><span>This is a test result foo bar is also here....</span></li></ul>
Expected Result:
<ul><li>Title Here <br><span>This is a test result <ahref=""/search/q?=foo"">foo</a><ahref=""/search/q?=bar"">bar</a> is also here....</span></li></ul>
Actual Result:
<ul><liTitleHere><br><spanThisisatestresult<ahref="/search?q=foo">foo</a><ahref="/search?q=bar">bar</a> is also here....></span></li></ul>
I've used HtmlSanitizer as the basis for injecting links to keywords in content. Basically, when a TextToken comes up, it looks for keywords in the value and wraps a link around the keyword.
Unfortunately I don't think this is the right approach, as it seems to mess up the parent nodes somehow.
This is the code I'm using to test inject links:
Which I call from a modification of the
Sanitize()
function:Test Html:
Expected Result:
Actual Result:
Example Project:
CleanAndLink.zip
The text was updated successfully, but these errors were encountered: