Additional attributes
See original GitHub issueThe main objective in my case is to be able to save highlights in a database then load them later. In my design, every highlight span should have title and id attributes. Is that feasible with the current library’s implementation? if not (which is mostly the case), can you add this feature? IMHO, it should be better on occurrence level, like the each handler, the reason is for instance if I want to provide a different id for each instance, like XXXX_1, XXXX_2 (the number being the occurrence number).
BTW, i tried to modify the element passed in the each callback like this:
element.setAttribute("id", "sohayb" + counter);
element.setAttribute("title", "sohayb");
var tmp = document.createElement("div");
tmp.appendChild(element);
console.log(tmp.innerHTML);
The log printed in the console had the expected result, but the whole spanned text is removed! If this is not the expected behaviour of the library, I can provide you with a JSFiddle link.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
@sohayb So you’ve built some kind of adapter to highlight user selections with mark.js? If so, I’d love to see this a third-party add-on for mark.js!
I’m glad you could solve your problem yourself.
Basically yes, because I needed that functionality, just highlight user selection. Will do that Add-on at some point! Thank you and thanks for your work 🥇