Hello,
I see on the homepage, hightlight.js can be used with nodejs as well. However I am not able to find any documentation or short sample which I can follow to use it on nodejs.
Would be really great if someone can point to right direction for this.
Thank you,
Indeed, our README doesn't mention node explicitly, we should fix that. In the meantime:
:+1:
i want know how to set css styles by highlight.js and i do not want to use a css style that i download from website and add a style tab in html ....so how to use css style when i use npm require higtlight and set css style
@gzponline hello ,l also find the way to use highlight in node without css.do you have some discovery锛焧hank you
@Ai01 no I use css file in my project, how to import from npm or install from hightlight.js
@gzponline just add import 'highlight.js/styles/github.css' in the js file. You can change the theme as you like.
@SeasideLee Thanks
What class do i need to apply for using highlight js for node? class="nodejs hljs"?
Is there any way to process arbitrary html string on nodejs, to let hljs find and process code blocks?
Or I should parse it first and extract code blocks?
I tried highlightAuto from API but it tries to highlight all the given string.
Is there any way to process arbitrary html string on nodejs, to let hljs find and process code blocks?
Or I should parse it first and extract code blocks?
You'd first need to parse it yourself and find the code blocks.
Most helpful comment
@gzponline just add
import 'highlight.js/styles/github.css'in the js file. You can change the theme as you like.