Highlight.js: How to use highlight.js on nodejs

Created on 30 Aug 2016  路  10Comments  路  Source: highlightjs/highlight.js

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,

docwebsite good first issue help welcome

Most helpful comment

@gzponline just add import 'highlight.js/styles/github.css' in the js file. You can change the theme as you like.

All 10 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kkeundotnet picture kkeundotnet  路  3Comments

goloroden picture goloroden  路  3Comments

wooorm picture wooorm  路  6Comments

starikovs picture starikovs  路  5Comments

niche4u picture niche4u  路  5Comments