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

@neabyte/chatmark

v0.1.3

Published

Expressive text formatting syntax built for everyday chat conversations

Readme

What is ChatMark?

ChatMark is a chat markup parser and HTML renderer. It parses paragraphs, blockquotes, fenced code blocks, and lists, with inline support for strong, emphasis, strikethrough, code, mentions, channels, filepaths, autolinks, and line breaks.

Installation

Deno:

deno add npm:@neabyte/chatmark

npm:

npm install @neabyte/chatmark

CDN (jsDelivr/esm.sh):

<script type="module">
  import Chatmark from 'https://cdn.jsdelivr.net/npm/@neabyte/chatmark/dist/index.mjs'
</script>

Or via esm.sh:

<script type="module">
  import Chatmark from 'https://esm.sh/@neabyte/chatmark'
</script>

Usage

HTML

import Chatmark from '@neabyte/chatmark'

// Render markup to an HTML string
const html = Chatmark.html('Hello *world* from @neabytelab!')
console.log(html)
// <p>Hello <strong>world</strong> from <span class="chatmark-mention" data-mention="neabytelab">@neabytelab</span>!</p>

Chatmark.html() parses source, escapes HTML special characters (&, <, >, ") in text and attributes, and joins the rendered blocks with \n.

Parse

import Chatmark from '@neabyte/chatmark'

// Parse markup into a document tree
const doc = Chatmark.parse('> Quote\n\n- *bold* and _italic_\n- ~strike~ and `code`')
console.log(doc)
// {
//   type: 'document',
//   children: [
//     {
//       type: 'blockquote',
//       children: [
//         {
//           type: 'paragraph',
//           children: [{ type: 'text', value: 'Quote' }]
//         }
//       ]
//     },
//     {
//       type: 'list',
//       ordered: false,
//       start: 1,
//       items: [
//         {
//           children: [
//             {
//               type: 'paragraph',
//               children: [
//                 { type: 'strong', children: [{ type: 'text', value: 'bold' }] },
//                 { type: 'text', value: ' and ' },
//                 { type: 'emphasis', children: [{ type: 'text', value: 'italic' }] }
//               ]
//             }
//           ]
//         },
//         {
//           children: [
//             {
//               type: 'paragraph',
//               children: [
//                 { type: 'strike', children: [{ type: 'text', value: 'strike' }] },
//                 { type: 'text', value: ' and ' },
//                 { type: 'code', value: 'code' }
//               ]
//             }
//           ]
//         }
//       ]
//     }
//   ]
// }

| Element | Rule | | ----------------- | ------------------------------------------------------------------------------------------------------------------------ | | Document | Returns { type: 'document', children } containing the parsed blocks. | | Blockquote | Nests up to a depth of 64. | | Ordered list | Keeps start when not 1. | | Fenced code block | Takes the first word after the fence as lang. | | Mention | Matches @ followed by 3 to 35 characters of a-z, 0-9, ., or _ (at most one . and one _, no outer .). | | Channel | Matches # followed by 1 to 80 characters of a-z, 0-9, ., _, or -. | | Filepath | Matches /path/to/file or C:\path\to\file up to 4096 characters. | | Autolink | Matches valid http:// and https:// URLs up to 2048 characters. |

API

Chatmark.html(source)

| Parameter | Type | Description | | --------- | -------- | ---------------------- | | source | string | Chat markup to render. |

Returns: string.

| Element | Syntax | Output | | ----------------- | -------------------------- | ------------------------------------------------------------------------------------ | | Paragraph | text | <p>text</p> | | Blockquote | > quote | <blockquote>\n<p>quote</p>\n</blockquote> | | Fenced code block | ```lang | <pre><code class="chatmark-codeblock-lang">...</code></pre> | | Bullet list | - item | <ul>\n<li>item</li>\n</ul> | | Ordered list | 1. item | <ol>\n<li>item</li>\n</ol> | | Strong | *text* or **text** | <strong>text</strong> | | Emphasis | _text_ or __text__ | <em>text</em> | | Strikethrough | ~text~ or ~~text~~ | <del>text</del> | | Inline code | `code` | <code>code</code> | | Mention | @handle | <span class="chatmark-mention" data-mention="handle">@handle</span> | | Channel | #channel | <span class="chatmark-channel" data-channel="channel">#channel</span> | | Filepath | /path/to/file | <span class="chatmark-filepath" data-filepath="/path/to/file">/path/to/file</span> | | Autolink | https://example.com | <a href="https://example.com">https://example.com</a> | | Hard line break | Two trailing spaces or \ | <br />\n |

Chatmark.parse(source)

| Parameter | Type | Description | | --------- | -------- | --------------------- | | source | string | Chat markup to parse. |

Returns: ChatmarkDocument.

interface ChatmarkDocument {
  type: 'document'
  children: ChatmarkBlock[]
}

interface ChatmarkParagraph {
  type: 'paragraph'
  children: ChatmarkInline[]
}

interface ChatmarkItem {
  children: Array<ChatmarkParagraph | ChatmarkListBlock>
}

interface ChatmarkListBlock {
  type: 'list'
  ordered: boolean
  start: number
  items: ChatmarkItem[]
}

type ChatmarkBlock =
  | ChatmarkParagraph
  | {
      type: 'blockquote'
      children: ChatmarkBlock[]
    }
  | {
      type: 'codeblock'
      lang: string
      code: string
    }
  | ChatmarkListBlock

type ChatmarkInline =
  | {
      type: 'text'
      value: string
    }
  | {
      type: 'mention'
      value: string
    }
  | {
      type: 'channel'
      value: string
    }
  | {
      type: 'filepath'
      value: string
    }
  | {
      type: 'strong'
      children: ChatmarkInline[]
    }
  | {
      type: 'emphasis'
      children: ChatmarkInline[]
    }
  | {
      type: 'strike'
      children: ChatmarkInline[]
    }
  | {
      type: 'code'
      value: string
    }
  | {
      type: 'autolink'
      href: string
      text: string
    }
  | {
      type: 'break'
    }

Build

npm run build

Testing

deno task check
deno task test

License

This project is licensed under the MIT license. See the LICENSE file for details.