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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@a24z/markdown-utils

v0.1.3

Published

Core markdown parsing and presentation utilities without React dependencies

Readme

@a24z/markdown-utils

Core markdown parsing and presentation utilities without React dependencies. Extract slides, parse chunks, and handle markdown transformations.

Installation

npm install @a24z/markdown-utils
# or
bun add @a24z/markdown-utils

Features

  • 📝 Markdown parsing - Parse markdown into typed chunks
  • 🎯 Slide extraction - Split markdown into presentation slides
  • 🔀 Presentation diffing - Compare two presentations slide-by-slide
  • 🔌 Extensible - Plugin system for custom chunk types
  • 🚀 Zero React dependencies - Pure TypeScript utilities
  • 📦 Lightweight - ~22KB bundled

Usage

Parse Markdown into Chunks

import { parseMarkdownChunks, CHUNK_TYPES } from '@a24z/markdown-utils';

const chunks = parseMarkdownChunks(markdownContent, 'my-prefix');

chunks.forEach(chunk => {
  if (chunk.type === CHUNK_TYPES.MERMAID) {
    // Handle mermaid diagram
    console.log('Mermaid:', chunk.content);
  }
});

Create Presentation from Markdown

import { parseMarkdownIntoPresentation, MarkdownPresentationFormat } from '@a24z/markdown-utils';

// Split by horizontal rules (---)
const presentation = parseMarkdownIntoPresentation(
  markdownContent,
  MarkdownPresentationFormat.HORIZONTAL_RULE
);

console.log(`${presentation.slides.length} slides found`);

Compare Two Presentations

import { diffPresentations, parseMarkdownIntoPresentation } from '@a24z/markdown-utils';

const beforePresentation = parseMarkdownIntoPresentation(beforeMarkdown);
const afterPresentation = parseMarkdownIntoPresentation(afterMarkdown);

const diff = diffPresentations(beforePresentation, afterPresentation);

console.log(`${diff.summary.modified} slides modified`);
console.log(`${diff.summary.added} slides added`);
console.log(`${diff.summary.removed} slides removed`);

// Iterate through slide-by-slide diffs
diff.slideDiffs.forEach(slideDiff => {
  console.log(`Slide status: ${slideDiff.status}`);

  if (slideDiff.status === 'modified') {
    // Access line-by-line content changes
    slideDiff.contentChanges?.forEach(change => {
      if (change.type === 'add') {
        console.log(`+ ${change.value}`);
      } else if (change.type === 'remove') {
        console.log(`- ${change.value}`);
      }
    });
  }
});

Extend with Custom Chunks

import { BaseChunk, parseMarkdownChunks } from '@a24z/markdown-utils';

// Define custom chunk type
interface MathChunk extends BaseChunk<'math_chunk'> {
  formula: string;
}

// Custom parser
const mathParser = (content: string, idPrefix: string): MathChunk[] => {
  // Parse LaTeX math blocks...
  return [];
};

// Use with parser
const chunks = parseMarkdownChunks<MathChunk | ContentChunk>(
  content,
  'prefix',
  [mathParser]
);

API

Types

Chunks:

  • BaseChunk<T> - Base interface for extensible chunks
  • MarkdownChunk, MermaidChunk, CodeChunk - Built-in chunk types

Presentations:

  • MarkdownPresentation, MarkdownSlide - Presentation types

Diffs:

  • PresentationDiff - Complete diff analysis between two presentations
  • SlideDiff - Diff between two versions of a slide
  • DiffSummary - Summary statistics for a presentation diff
  • DiffStatus - Status of a slide: 'added' | 'removed' | 'modified' | 'unchanged' | 'moved'
  • TextDiff - Line-level text change

Functions

Parsing:

  • parseMarkdownChunks() - Parse markdown into typed chunks
  • parseMarkdownIntoPresentation() - Create presentation from markdown
  • extractSlideTitle() - Extract title from slide content

Diffing:

  • diffPresentations() - Compare two presentations and generate diff
  • calculateDiffSummary() - Generate summary statistics from a diff
  • diffText() - Low-level line-by-line text comparison
  • hasChanges() - Check if a diff has any changes
  • formatDiffSummary() - Format summary as human-readable string

Utilities:

  • parseBashCommands() - Parse bash code blocks
  • transformImageUrl() - Transform relative URLs to absolute
  • slidesAreEqual() - Check if two slides are identical
  • normalizeText() - Normalize text for comparison

License

MIT - a24z Team