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

@lakshaykumar/rich-text-editor

v1.2.0

Published

A lightweight, modular, and dependency-free Rich Text Editor built with modern JavaScript.

Readme

@lakshaykumar/rich-text-editor

A lightweight, modular, and dependency-free Rich Text Editor built with modern JavaScript (ES6+).

Designed for ease of use and performance, this editor provides a clean WYSIWYG experience without the bloat of heavy legacy libraries.

🔴 View Live Demo

Features

  • Zero Dependencies: Pure JavaScript, lightweight and fast.
  • Auto-Save: Automatically saves content to LocalStorage to prevent data loss.
  • Slash Commands: Type / to access a quick menu for headings, lists, media, and more.
  • Link Previews: Hover over links to preview URLs, edit, or unlink.
  • Syntax Highlighting: Basic code block highlighting for JavaScript/HTML.
  • Image Support: Drag & Drop and Paste support (auto-converted to Base64).
  • Export Options: Built-in support to export content as Markdown or PDF.
  • Clean Output: Generates semantic HTML5 output with optional minification.
  • Shared Styling: Comes with a dedicated CSS file for Editor and Preview modes.
  • Modular Architecture: Built with ES Modules for tree-shaking and maintainability.

Installation & Usage

Choose the method that best fits your project.

Method 1: NPM (Recommended for Bundlers)

Ideal for modern projects using Webpack, Vite, Parcel, or Rollup.

  1. Install the package:

    npm install @lakshaykumar/rich-text-editor
  2. Usage in your project (e.g., React/Vue/Vanilla JS):

    // 1. Import the Editor Class
    import RichTextEditor from '@lakshaykumar/rich-text-editor';
       
    // 2. Import the Styles
    import '@lakshaykumar/rich-text-editor/src/styles/rte.css';
       
    // 3. Initialize on a container
    const editor = new RichTextEditor('#my-editor', {
        placeholder: 'Start writing...'
    });

Method 2: CDN (Fastest, No Build)

Use the editor directly in the browser via unpkg or jsDelivr.

Full HTML Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Rich Text Editor - CDN Demo</title>
    <!-- Import Styles -->
    <link rel="stylesheet" href="https://unpkg.com/@lakshaykumar/rich-text-editor@latest/src/styles/rte.css">
    <style>
        body { font-family: sans-serif; padding: 20px; }
    </style>
</head>
<body>

    <h1>My Editor</h1>
    <div id="editor-container"></div>

    <!-- Import Library -->
    <script src="https://unpkg.com/@lakshaykumar/rich-text-editor@latest/dist/rich-text-editor.min.js"></script>

    <script>
        // Initialize the editor
        const editor = new RichTextEditor('#editor-container', {
            placeholder: 'Type something amazing...'
        });
    </script>
</body>
</html>

Method 3: Direct Download (Offline / No NPM)

Manually download the files and host them locally.

  1. Download the dist/ folder and src/styles/ form this repository.
  2. Structure:
    /my-project
      /libs
        /rich-text-editor
          /dist
            rich-text-editor.min.js
          /styles
            rte.css
      index.html
  3. Usage:
    <link rel="stylesheet" href="libs/rich-text-editor/styles/rte.css">
    <script src="libs/rich-text-editor/dist/rich-text-editor.min.js"></script>
    
    <div id="editor"></div>
    
    <script>
        const editor = new RichTextEditor('#editor');
    </script>

Configuration & API

Initialization Options

const editor = new RichTextEditor('#target', {
    placeholder: 'Start typing...', // Placeholder text
    enableAutoSave: true,           // Persist data to localStorage
    autoSaveKey: 'unique-id'        // Key for localStorage (default: URL + Selector)
});

Methods

// Get HTML Content
const html = editor.getHTML();

// Get Minified HTML (removes comments/whitespace)
const minified = editor.getHTML(true);

// Set HTML Content
editor.setHTML('<p>New content...</p>');

// Clear Editor
editor.clear();

Structure

rich-text-editor/
├── src/
│   ├── editor/          # Core Logic
│   └── styles/          # Styling
├── demo-editor.html     # Local Demo
└── README.md

License & Attribution

This project is licensed under the MIT License.

You are free to use, modify, and distribute this software in any project, commercial or personal. Use of this software requires preservation of the copyright notice and attribution to the original author, Lakshay Kumar.

Reference for Import: When using this package, please keep the package namespace @lakshaysharma684/rich-text-editor to ensure proper credit is maintained.

import RichTextEditor from '@lakshaykumar/rich-text-editor';