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

moonbit-syntax-highlighter

v0.1.1

Published

Reusable MoonBit syntax grammar package for documentation tooling and front-end highlighters.

Readme

moonbit-syntax-highlighter

Reusable MoonBit syntax grammar package for front-end documentation tooling.

This package ships two layers:

  • the original MIT-licensed MoonBit Sublime syntax source for reuse and attribution
  • a Shiki-compatible TextMate grammar registration for documentation stacks such as VitePress

It is framework-agnostic by design: the package ships raw grammar access, metadata, and a small registration helper instead of binding itself to a single docs stack.

What This Package Exports

  • moonbitGrammarPath: absolute local path to the vendored moonbit.sublime-syntax
  • moonbitGrammar: raw grammar file contents as a string
  • readMoonbitGrammar(): reads the packaged grammar from disk
  • moonbitTextMateGrammar: a Shiki-compatible TextMate grammar object for MoonBit
  • moonbitLanguage: language metadata for consumers that accept a custom language registration object
  • createMoonbitLanguageRegistration(): returns metadata plus a Shiki-compatible grammar object for tools that prefer in-memory registration
  • moonbitAliases: common aliases such as moonbit, mbt, and mbti

Install

pnpm add moonbit-syntax-highlighter

Basic Usage

import {
  createMoonbitLanguageRegistration,
  moonbitTextMateGrammar,
} from 'moonbit-syntax-highlighter'

const language = createMoonbitLanguageRegistration()

console.log(language.scopeName)
console.log(moonbitTextMateGrammar.scopeName)
import { moonbitGrammar } from 'moonbit-syntax-highlighter/content'

console.log(moonbitGrammar.slice(0, 40))
import { createHighlighter } from 'shiki'
import { createMoonbitLanguageRegistration } from 'moonbit-syntax-highlighter'

const highlighter = await createHighlighter({
  themes: ['github-light'],
  langs: [createMoonbitLanguageRegistration()],
})

const html = highlighter.codeToHtml('pub fn main() -> Int {\n  return 1\n}', {
  lang: 'moonbit',
  theme: 'github-light',
})

console.log(html)

Intended Consumers

  • Shiki-based documentation sites such as VitePress or Astro
  • Markdown pipelines that can register external TextMate-style grammars
  • Internal tooling that needs a stable MoonBit language metadata entry point

Source and Attribution

The vendored syntax source in syntaxes/moonbit.sublime-syntax is based on the MIT-licensed MoonBit Sublime syntax project by hyrious:

  • upstream repo: https://github.com/hyrious/moonbit-syntax-highlight
  • upstream file: MoonBit.sublime-syntax

This package preserves upstream attribution in LICENSE.upstream and is intended to make the grammar easier to consume from documentation tooling.

Current Scope

This package currently focuses on practical static highlighting for docs and examples. It does not yet provide semantic highlighting, Markdown injection grammars, or editor-specific extension packaging.

Local Development

pnpm run check
pnpm run dev
pnpm run pack:check

pnpm run dev uses Node watch mode to rerun the package self-check whenever files change.

pnpm run pack:check builds the tarball locally so you can inspect the exact files that would be published.