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

microtext

v2.1.0

Published

a library of small (and probably inefficient) utility functions for messing with text.

Readme

microtext

A library of small (and probably inefficient) utility functions for messing with text.

Getting started

node:

$ npm i microtext

and in your js:

const { micromarkup, microtemplate } = require('microtext')

or if you prefer ES Modules (browser):

import { microtemplate, micromarkup } from 'https://cdn.skypack.dev/microtext';

Functions exported:


micromarkup

A fairly small "markdown-light" parser.

Takes input of a string and returns the appropriate html.

Syntax

  • Links — default
    • The exact same as normal markdown:
    • [hello](# )<a href="#" target="_blank" rel="noopener noreferrer">hello</a>
  • Italics — default
    • Once again the same as normal markdown:
    • *hello*<i>hello</i>
    • micromarkup also supports the underscore syntax for italics: _hello_
  • Bold — default
    • **hello**<b>hello</b>
    • micromarkup also supports the double underscore syntax for bold: __hello__
  • Highlights — optional
    • ::hello::<mark>hello</mark>
  • Superscript — optional
    • ˆhelloˆ<sup>hello</sup>
    • to type ˆ on a mac: option shift I
  • Subscript — optional
    • ˇhelloˇ<sub>hello</sub>
    • to type ˇ on a mac: option shift T

note: micromarkup does not parse paragraphs into <p> tags.

Usage

//// BASIC
micromarkup(inputText)
// eg:
micromarkup("**bold text!**")
// returns: <b>bold text!</b>
  
//// WITH OPTIONS
micromarkup(inputText, options)
// eg:
micromarkup("::highlighted text!::", { highlighted: true })
// returns: <mark>highlighted text!</mark>

where:

  • inputText is a string of micromarkup text formatted with the syntax above (required)
  • options is a key-value object that contains the options defined below (optional)

Options

default = {
    links: true,
    newTab: true,
    bold: true,
    italics: true,
    highlights: false,
    supSub: false
  }
  • links: specifies whether or not links should be parsed.

  • newTab: whether or not the link parser should make links open in a new tab.

  • bold: whether or not bold text should be parsed.

  • italics: whether or not italic text should be parsed.

  • highlights: whether or not highlights should be parsed.

  • supSub: whether or not superscripts and subscripts should be parsed.

microtemplate

A simple template language that just inserts variables into your text.

Takes input of a string and returns another string with variables subbed in.

Syntax

hello λworldVarλ

Anything inside of the λ symbols will be treated as the variable name to replace with the text you want.

Usage

//// BASIC
microtemplate(inputString, variables)
// eg.
microtemplate('hello λvarλ', {'var': 'world'})
// returns: 'hello world'
  
//// WITH CUSTOM DELIMITER
microtemplate(inputString, variables, delimiter)
// eg.
microtemplate('hello §var§', {'var': 'world'}, '§')
// returns: 'hello world'

where:

  • inputString is the input text formatted with the syntax above. (required)

  • variables is an object of key-value pairs, where the key is the text inside the delimiter (λ), and the value is what to replace it with. (required)

  • delimiter is the symbol that is used to contain the variable names. The default is the λ symbol. (optional)

microdata

a very light data storage language, only really designed for static data.

Takes a string input and returns a JS object.

Syntax

[hello]
world

The above text returns the js:

{
  hello: "world",
}

note that microdata removes newlines from the original string for its very simple algorithm to work.

Usage

//// BASIC
// eg.
microdata(`
[hello]
cool
`) 
/* returns:
{
  hello: "cool"
}

Made by @ehne. Consider giving microtext a ⭐️ if it helped you!

npm GitHub Repo stars