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

monogon

v0.3.3

Published

Modern syntax highlighting for developer tooling

Readme

Monogon

2kb <code> block with syntax highlighting meant for the dev environment.

Zero dependencies, support for most frameworks, mildly themable.

Using the CSS Highlight, meaning low browser support.

alt text

[!IMPORTANT] Monogon is meant for developer tooling and supports very few languages. Think config files.

If you don't need editable code snippets, look at Shiki, it's amazing.

If you need editable snippets, Codemirror might be worth a look.

No SSR support for now.

Supported languages

| Language | property | syntax | formatting | | --------- | --------- | ------ | ---------- | | JSON | json | ✅ | ✅ | | YAML | yaml | ✅ | ❌ | | CSS | css | ❓ | ❌ | | plaintext | plaintext | - | - |

Usage

Import it

import 'monogon';

Use in your HTML as a web component.

<monogon-code lang="json" content='{ "names": ["ian", "ana"], size: "2kb", status: null  }'>Click me</monogon-code>

<script>
  document.querySelector('monogon-code').addEventListener('input', (event) => {
    console.log(event.target.value);
  });
</script>

Frameworks

Vue

import MonogonCode from 'monogon/vue';

const content = ref('{ "json": ["this", "is", "json"], "how": 42  }')
const handleInput = (e) => { content.value = e.target.value }

<MonogonCode :content="content" @input="handleInput">Click me</MonogonCode>

React

import MonogonCode from 'monogon/react';

const content = '{ "json": ["this", "is", "json"], "how": 42  }';
const handleInput = (e) => { console.log(e.target.value) }

<MonogonCode content={content} lang="json" onInput={handleInput} />

Preact

import MonogonCode from 'monogon/preact';

const content = '{ "json": ["this", "is", "json"], "how": 42  }';
const handleInput = (e) => { console.log(e.target.value) }

<MonogonCode content={content} lang="json" onInput={handleInput} />

Svelte

There is no native support yet for Svelte, so the web component needs to be used.

import 'monogon';

<monogon-code {content} lang="json" oninput={handleInput}></monogon-code>

Solid

import MonogonCode from 'monogon/solid';
const handleInput = (e) => { console.log(e.target.value) }

<MonogonCode content={content} lang="json" onInput={handleInput} />

Options

For a read-only code block just add the readonly prop/attribute.

Theming

Monogon comes with a VSCode-like dark and light theme. This theme can be changed by changing the css properties on monogon-code.

The simplest way to do so is:

monogon-el.custom-theme-name {
  --mng-background: #0f0;
  /* ...other changes, see lit below */
}
@media (prefers-color-scheme: dark) {
  monogon-el.custom-theme-name {
    --mng-background: #040;
    /* ...other changes, see lit below */
  }
}

Full list of css properties used:

.default-theme {
  /* Generic */
  --mng-text: #213547;
  --mng-background: #f1f1f1;
  /* Proper highlighting */
  --mng-string: #8b251e;
  --mng-key: #c32b1d;
  --mng-number: #4a845b;
  --mng-boolean: #3716f5;
  --mng-null: #3716f5;
  --mng-comment: #4e862d;
  --mng-curly-brackets: #59913e;
  --mng-square-brackets: #59913e;
  --mng-keyword: #666;
  --mng-dashes: #444;
}

With SSR

SSR is not yet supported, you need to load it in the browser during page load.


Made with 🍕 in Amsterdam.