npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

highlight-plus

v1.0.2

Published

A React component that extends react-highlight to highlight search terms within syntax-highlighted code.

Readme

highlight-plus

Description

highlight-plus is a React component built on top of react-highlight, extending its functionality by allowing you to highlight specific words within the syntax-highlighted code.

It provides an easy way to highlight keywords, variables, or any other word within the syntax-highlighted code snippet.

Features

  • Built on top of react-highlight, so it supports various programming languages for syntax highlighting.

  • Allows highlighting of specific word within the syntax highlighted code.

  • Customizable highlight color with support for all legal CSS color values (hexadecimal, RGB, RGBA, HSL, HSLA, predefined).

Installation

  • To install via npm:

    npm install highlight-plus
  • To install via yarn:

    yarn add highlight-plus

Usage

  • Basic Usage:

    import React from 'react';
    import HighlightPlus from "highlight-plus";
    
    const MyComponent = () => {
        const code_string = `
            function helloHighlightPlus () {
                const greet_msg = "Hello, highlight-plus";
                console.log(greet_msg);
            }
        `;
    
        const word_to_highlight = "high";
    
        return (
            <div>
                <h1>Highlight Plus example one</h1>
                <HighlightPlus
                    language="javascript"
                    word_to_highlight={word_to_highlight}
                    code_content={code_string}
                />
            </div>
        );
    }
  • With custom highlight color:

    import React from 'react';
    import HighlightPlus from "highlight-plus";
    
    const MyComponent = () => {
        const code_string = `
            function helloHighlightPlus () {
                const greet_msg = "Hello, highlight-plus";
                console.log(greet_msg);
            }
        `;
    
        const word_to_highlight = "high";
    
        return (
            <div>
                <h1>Highlight Plus example two</h1>
                <HighlightPlus
                    language="javascript"
                    word_to_highlight={word_to_highlight}
                    highlight_color="#ff6347"
                    code_content={code_string}
                />
            </div>
        );
    }

Props

| Prop name | Description | Data type | Default value | | -- | -- | -- | -- | | code_content | Code to be displayed | string | "" | | word_to_highlight | String to be highlighted | string | "" | | language | Programming language of the code to be displayed | string | auto-detected | | highlight_color | Background color of the highlighted string | string | yellow |

Customizing Syntax Highlighting

highlight.js offers a wide range of themes to choose from for syntax highlighting. You can find various CSS files for different themes at cdnjs.com.

To use a custom theme, simply link CSS in the <head> tag in your HTML file or just import the desired CSS file at the top of your CSS.

Example 1: Linking CSS inside the <head> tag

<html>
    <head>
        <link 
            rel="stylesheet" 
            href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/1c-light.min.css" 
        />
    </head>
    <body></body>
</html>

Example 2: Importing in CSS file

@import url("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/1c-light.min.css");

License

This project is licensed under the MIT License. See the LICENSE file for details.