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 🙏

© 2025 – Pkg Stats / Ryan Hefner

qedit

v0.2.0

Published

Small web code editor

Downloads

21

Readme

Install

npm install qedit

or

<script src="path/to/lib/qedit.js">

And include basic styles:

<link rel="stylesheet" href="path/to/lib/qedit.css">

Usage

The basic structure consist in three wrappers: div > pre > code. The main div wrapper is enhanced with the editor functionality, while the pre > code combo is the standard HTML5 to embed source code.

<div class="qedit">
  <pre><code>function hello() {
  return 'world';
}</code></pre>
</div>

Then you init the editor with create(container):

import Qedit from 'qedit';

Qedit.create(document.querySelector('.qedit'));

If you call Qedit.create() without a container element (or null), it'll look for and instantiate all elements with class name .qedit.

Syntax highlighter

By default, there is no syntax highlighting when creating a Qedit instance. However, the library ships with three plugins for different highlighters you can include in the options param:

Prism.js

import Qedit from 'qedit';
import QeditPrism from 'qedit/plugins/prism';

Qedit.create(document.querySelector('.qedit'), {
  render: QeditPrism,
});

Don't forget to npm install prism or include it in a script tag.

Highlight.js

import Qedit from 'qedit';
import QeditHljs from 'qedit/plugins/hljs';

Qedit.create(document.querySelector('.qedit'), {
  render: QeditHljs,
});

Don't forget to npm install highlight.js or include it in a script tag.

Code Prettify

import Qedit from 'qedit';
import QeditPrettify from 'qedit/plugins/prettify';

Qedit.create(document.querySelector('.qedit'), {
  render: QeditPrettify,
});

Don't forget to npm install code-prettify or include it in a script tag.

Plugins

Qedit plugins are simply defined as functions called on editor initialization with the editor instance as only argument. Plugins are listed in the plugins array of the options param.

Prettier

Currently the only plugin shipped with the library:

import Qedit from 'qedit';
import QeditPrettier from 'qedit/plugins/prettier';

Qedit.create(document.querySelector('.qedit'), {
  plugins: [QeditPrettier()],
});

Optionally, you can configure the plugin passing an options object. The defaults are:

  plugins: [QeditPrettier({
    trigger: 'ctrl+enter',
    formatOnInit: false,
    prettierOptions: { parser: 'babel' },
  })],

Don't forget to npm install prettier or include it in a script tag (along with prettier/parser-babel if you use the default behavior).

Options and defaults

Qedit.create(null, {
  language: null, // if null, it'll look for the container class .language-xxxx
  indentation: '  ', // what to insert/remove when pressing tab/shift+tab
  triggersIndent: ['{', '(', '[', ':'], // characters that add indentation on line break
  triggersDedent: ['}', ')', ']'], // characters that removes indentation
  highlightBracketPairs: true, // whether to highlight matching bracket pairs or not
  pairOpen: ['{', '(', '['], // pairs to highlight
  pairClose: ['}', ')', ']'], // matching pair in same order as in pairOpen
  autoPairs: { '{': '}', '(': ')', '[': ']', '<': '>', '"': '"', "'": "'" }, // pairs to automatically insert
  showLineNumbers: false, // whether to show line numbers or not
  plugins: [], // List of plugins
  render: (code, el) => { el.textContent = code + '\u200B' }, // rendering function
});