I have created responsive Syntax highlighter for website
I have created responsive Syntax highlighter for website
For further actions, you may consider blocking this person and/or reporting abuse
Saurabh Rai -
Kirubel Kinfe -
Manuel Artero Anguita 🟨 -
briankarlsayen -
Once suspended, bhavyashah will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, bhavyashah will be able to comment and publish posts again.
Once unpublished, all posts by bhavyashah will become hidden and only accessible to themselves.
If bhavyashah is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Bhavyashah.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag bhavyashah:
Unflagging bhavyashah will restore default visibility to their posts.
Top comments (4)
For those wondering, Bhavyashah here used highlight.js to get some syntax highlight of HTML. That library allows you to use the themes it provides or do your own with CSS, and is pretty easy to set up. You just need to install it and import it if you're working with a bundler, or just do as he did and reference it in your html like this:
Remember that you need to start it, so:
And finally put your code inside a
code
that's inside apre
, and thatcode
tag has to have the classnamelanguage-html
to highlight html,language-css
to highlight css, and so on.You can check highlight.js usage docs to get more info about how to set it up yourself.
There are some alternatives out there, one pretty good and lightweight alternative is called lolight, and if you need something more powerful, you can just use Monaco Editor which is basically VSCode in the browser.
Cheers!
Sir, But this code is not take your pagespeed higher it not slow down your website it just a light weight syntax highlighter & full responsive I have give just an example of it
I explained what you did to folks wondering about your code, because you only shared a snippet. It seems you might be confused about the explanation, but I just showed how to setup highlight JS and I added some alternative at the end.
Thanks Sir for Explaining In details I also try to explain in detail in next time