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

papyr-core

v0.1.1

Published

Core package for Papyr - a markdown knowledge management system

Readme

Papyr Core

A powerful core package for building markdown-based knowledge management systems. Papyr Core provides essential functionality for parsing, analyzing, and managing interconnected markdown documents.

Features

  • Markdown Processing: Parse markdown with frontmatter support
  • Graph Analysis: Build and analyze document relationships
  • Wiki Links: Support for [[wiki-style]] links between documents
  • Search: Full-text search with FlexSearch
  • Analytics: Document statistics and insights
  • Export: JSON export capabilities
  • TypeScript: Full TypeScript support with type definitions

Installation

npm install papyr-core

Quick Start

import { PapyrBuilder, PapyrGraph, PapyrAnalytics } from 'papyr-core';

// Build a knowledge base from markdown files
const builder = new PapyrBuilder();
const data = await builder.buildFromDirectory('./notes');

// Analyze the graph
const graph = new PapyrGraph(data.graph);
const analytics = new PapyrAnalytics(data);

// Get insights
console.log('Total notes:', analytics.getTotalNotes());
console.log('Orphaned notes:', analytics.getOrphanedNotes());
console.log('Most linked notes:', analytics.getMostLinkedNotes());

API Reference

Core Classes

  • PapyrBuilder: Build knowledge bases from markdown files
  • PapyrGraph: Analyze document relationships and graph structure
  • PapyrAnalytics: Generate insights and statistics
  • PapyrSearch: Full-text search across documents
  • PapyrFileProcessor: Process individual markdown files

Key Methods

PapyrBuilder

  • buildFromDirectory(path: string): Build from a directory of markdown files
  • buildFromFiles(files: string[]): Build from specific file paths
  • buildFromContent(content: string, filename?: string): Build from markdown content

PapyrGraph

  • getNeighbors(nodeId: string): Get connected documents
  • getPath(from: string, to: string): Find path between documents
  • getComponents(): Get disconnected graph components

PapyrAnalytics

  • getTotalNotes(): Count total documents
  • getOrphanedNotes(): Find documents with no connections
  • getMostLinkedNotes(limit?: number): Get most referenced documents

Configuration

The package supports various configuration options through the builder:

const builder = new PapyrBuilder({
  includeFrontmatter: true,
  parseWikiLinks: true,
  generateGraph: true,
  generateSearchIndex: true
});

Development

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm

Setup

# Install dependencies
pnpm install

# Build the package
pnpm build

# Run tests
pnpm test

# Run tests with coverage
pnpm test:coverage

# Development mode (watch for changes)
pnpm dev

Project Structure

papyr-core/
├── src/           # Source code
├── tests/         # Test files
├── dist/          # Built output (generated)
├── package.json   # Package configuration
├── tsconfig.json  # TypeScript configuration
├── vite.config.ts # Build configuration
└── vitest.config.ts # Test configuration

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

Related Packages

  • papyr-react: React components for building Papyr UIs
  • papyr-cli: Command-line interface for Papyr