wcoder/highlightjs-line-numbers.js

Expose a function that returns the lines of code

MurhafSousli opened this issue · 0 comments

Hi, nice plugin!

I have a highlightjs module for Angular and I wanted to integrate your plugin in it, but the problem is that your plugin modifies the DOM directly, which causes the "auto-highlight" feature to stuck in an infinite loop

I use MutationObserver to highlight text content

 /** Highlight when text content changes */
 this.domObs = new MutationObserver(() => this.highlightTextContent());
 this.domObs.observe(this.el, { childList: true, subtree: true });

I was wondering if you can expose a function that returns the lines of code, if not possible, can you guide me on how do you count the lines of codes (I could not get how it works in the source code)

Many thanks,