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

@itslil/lil2-remark-breaks

v0.1.0

Published

remark-breaks, rewritten in typed LilScript: line endings in text become hard breaks, same trees

Readme

lil2-remark-breaks

remark-breaks 4.0.0 rewritten in typed LilScript: every line ending in text becomes a hard break (<br>), on the flat lil2 pipeline, with the same trees as upstream.

The transform walks the mdast arena's text nodes and splits them at \r\n, \n and \r into text and break nodes (int kinds, no position, as upstream's find-and-replace leaves them). Inside the family it is compiled into lil2-react-markdown's full flavor.

import {fromMarkdown, markdownToHast} from '@itslil/lil2-remark-breaks'

markdownToHast('one\ntwo', false) // hast columns: p > ["one", br, "\n", "two"]

Install

npm install @itslil/lil2-remark-breaks

TypeScript types are included. One ES module per entry; Node, Deno, Bun and workers get dist/, bundlers targeting browsers get dist/browser/ through the browser condition.

Use

import {markdownToHast} from '@itslil/lil2-remark-breaks'
import {TAG_BR} from '@itslil/lil2-remark-breaks/constants'

const [, , , , , tag] = markdownToHast('roses are red\nviolets are blue')
console.log(tag.filter(t => t === TAG_BR).length) // 1: the line ending is a <br>

fromMarkdown(value) and markdownToHast(value, allowDangerousHtml?) are remark-parse (and remark-rehype) with remark-breaks. In React, use @itslil/lil2-react-markdown/full with plugins={[BREAKS]}.

Which package

| you want | package | |---|---| | React elements | @itslil/lil2-react-markdown (/gfm, /full for GFM, math, KaTeX) | | an HTML string, CommonMark | @itslil/lil2-micromark | | an HTML string with GFM, math or KaTeX | renderToStaticMarkup of lil2-react-markdown's /full flavor (below) | | mdast (syntax tree) | lil2-mdast-util-from-markdown; with GFM lil2-remark-gfm, math lil2-remark-math, breaks lil2-remark-breaks | | elements from hast columns through any JSX runtime | lil2-hast-util-to-jsx-runtime | | hast (HTML tree) | lil2-mdast-util-to-hast and the same three, or lil2-rehype-katex with formulas rendered |

Every package is one self-contained ES module with no runtime dependencies (React and KaTeX aside), ships its TypeScript types, and resolves to a Node build or a browser build through its exports conditions.

Measured (2026-10-04)

The browser build against [email protected] bundled for the browser with esbuild and minified by Terser, esbuild and Oxc (the smallest shown). Each objective is its own LilScript build (effort level 12, lazy_functions).

| | lil2 | upstream, best minifier | difference | |---|---:|---:|---:| | raw | 59,016 | 75,302 (Terser) | −21.6% | | gzip (9) | 19,337 | 20,862 (Terser) | −7.3% | | Brotli (11) | 16,938 | 18,684 (Terser) | −9.3% |

Speed, upstream → lil2: markdown with breaks to HTML, median per call in a fresh browser context per lane, after checking that both give the same output (Playwright; Chromium 151, Firefox 153; AMD EPYC 7763 64-Core Processor). Cold rows are the first import and the first call of a fresh page.

| | Chromium | Firefox | |---|---:|---:| | chat (1 KB) | 0.71 → 0.27 ms (0.38×) | 1.11 → 0.54 ms (0.48×) | | readme (26 KB) | 15.7 → 6.40 ms (0.41×) | 32.0 → 13.0 ms (0.41×) | | import, cold | 5.00 → 5.20 ms | 11.0 → 11.0 ms | | first call, cold | 11.8 → 11.0 ms | 15.0 → 11.0 ms |

Behaviour

test/differential.test.mjs compares the mdast and the hast with upstream's (newlineToBreak(fromMarkdown(md))) as rows of indexed arrays on line-ending edge cases and the CommonMark corpus; test/browser.test.mjs runs the browser build in Chromium and Firefox. All are equal.

License

MIT; see NOTICE.md.