wcoder / highlightjs-line-numbers.js

Line numbering plugin for Highlight.js

Home Page:https://wcoder.github.io/highlightjs-line-numbers.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I use it in Node.js

jasonxia23 opened this issue · comments

How can I use it in Node.js

Hi, thanks for the question!

Current implementation doesn't allow use that with Node.JS

IMO, to support using in Node.js, lineNumbersBlock should be extracted, which may be a breaking change to your preexisting API.

I found the code already pulled out (and nicely in typescript) here in another comment by @pwnoy.

It looks like Highlightjs supports node out of the box along with plugins,
https://highlightjs.readthedocs.io/en/latest/plugin-api.html. Could we reconfigure this package to be added via a highlightjs plugin for both node and the browser? Or would it be better to create a fork?