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

markdown-it-digit

v1.0.0

Published

A markdown-it plugin for locale-aware integer formatting.

Readme

markdown-it-digit

日本語

A markdown-it plugin that formats integers written with an explicit locale marker. Ordinary numbers are left unchanged.

Install

npm install markdown-it-digit

Usage

const MarkdownIt = require("markdown-it");
const markdownItDigit = require("markdown-it-digit");

const md = new MarkdownIt().use(markdownItDigit);

md.render("$1234567${en}");
// <p>1,234,567</p>\n

The package provides a CommonJS entry point. It does not provide an ESM entry point or plugin options.

Syntax

$<number>${<locale>}

<number> must contain one or more ASCII digits (09). Leading zeros are preserved. Locale identifiers are case-sensitive.

Supported locales

| Locale | Format | | --- | --- | | en | Groups digits in threes with commas | | in | Uses a three-digit final group and two-digit preceding groups | | jp | Inserts Japanese myriad-based units | | cn | Inserts Simplified Chinese myriad-based units | | kr | Inserts Korean myriad-based units | | tw | Inserts Traditional Chinese myriad-based units |

jp, cn, kr, and tw are format identifiers defined by this package. They are not ISO language codes or BCP 47 language tags.

Examples

| Input | HTML output | | --- | --- | | $1234567${en} | 1,234,567 | | $123456789${in} | 12,34,56,789 | | $123456789${jp} | 1<sub>億</sub>2345<sub>万</sub>6789 | | $123456789${cn} | 1<sub>亿</sub>2345<sub>万</sub>6789 | | $123456789${kr} | 1<sub>억</sub>2345<sub>만</sub>6789 | | $123456789${tw} | 1<sub>億</sub>2345<sub>萬</sub>6789 | | $0001000${en} | 0,001,000 |

East Asian formats preserve every digit and every zero-only group. Units are visual position guides; the value is not abbreviated.

Content that is not transformed

The plugin transforms valid syntax in ordinary inline text, including link labels and text between HTML tags. It does not transform syntax in:

  • fenced or indented code blocks
  • inline code
  • URLs or text beginning with an explicit URI scheme
  • Markdown link destinations
  • HTML attributes or HTML comments
  • syntax escaped with a Markdown backslash

Ordinary numbers without the plugin syntax are not transformed.

Invalid input and unsupported locales

Invalid syntax is left unchanged. A syntactically valid but unsupported or incorrectly cased locale, such as unknown, EN, or en-US, is also left unchanged.

If a formatter unexpectedly throws, the original syntax is returned with HTML escaping instead of failing the complete Markdown render.

Public API

The only public API is the markdown-it plugin function returned by:

const markdownItDigit = require("markdown-it-digit");

Internal parsers, renderers, locale modules, formatter registries, and token metadata are not public and cannot be imported through package subpaths. External locale registration is not supported.

For the complete behavior, see the specification.

License

MIT