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

markdowns-peek

v1.0.21

Published

A beautiful GitHub Markdown file viewer for web applications

Downloads

140

Readme

MarkdownsPeek

Tests Star on GitHub

A beautiful GitHub Markdown file viewer for web applications.

Description

MarkdownsPeek is a headless content provider that fetches Markdown files directly from GitHub repositories at runtime and renders them in your application. Instead of bundling static content or coupling copy updates to deploys, it decouples content from code so product teams can ship UI changes independently from editorial workflows.

Key characteristics of the headless approach:

  • Content lives in GitHub: writers and developers collaborate via branches, reviews, and versioning without a custom CMS.
  • Runtime delivery: the widget retrieves a directory listing and individual Markdown files from the GitHub API on demand.
  • Client-rendered UI shell: your app provides the hosting surface; MarkdownsPeek handles listing, loading states, sanitization, and display.
  • Optional routing: deep links can point to specific articles; the widget can hide the file list to create a fullscreen article experience.
  • Progressive enhancement: initial UI mounts instantly; content loads asynchronously with visual feedback.

Why this matters:

  • Faster content iteration: update Markdown in GitHub and see it live without redeploying the app.
  • Lower operational load: no servers or databases to run for content delivery.
  • Strong governance: use pull requests, code owners, and CI for quality and compliance.
  • Portable and embeddable: drop the widget into any site or microsite without changing your build pipeline.

How it works at a glance:

  1. The widget mounts into a container and injects scoped styles using a unique prefix.
  2. It fetches a GitHub directory, filters .md files, and renders a selectable list.
  3. On selection or deep link, it fetches and sanitizes the Markdown, then renders it with reading-time and optional metadata (date from a header comment).
  4. With routing enabled, fullscreen mode can be used to present an article URL suitable for sharing or embedding.

Preview

Live


Installation

npm install markdowns-peek

Usage

import { MarkdownsPeek } from 'markdowns-peek';

const container = document.getElementById('markdown-viewer');
const viewer = new MarkdownsPeek(container, {
  prefix: 'custom-prefix-',
  owner: "peterporzuczek",
  repo: "articles",
  path: "articles-md",
  disableStyles: false,
  sortAlphabetically: false,
  showGitHubLink: false,
  loadFirstFileAutomatically: false // As of now important to show without routing launched
  texts: {
    menu: 'Menu',
    files: 'Files',
    loading: 'Loading...',
    selectFile: 'Select file to view',
    error: 'Error:',
    noFiles: 'No files found'
  }
});

Testing

This project uses Jest and jest-cucumber for testing. To run the tests:

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

Test Structure

  • features/ - Gherkin feature files
  • tests/ - Jest test files with step definitions
  • jest.config.js - Jest configuration
  • jest.setup.js - Jest setup for DOM environment

Running Tests

The tests use jsdom to simulate a browser environment and test the library's functionality without modifying the core logic.

Development

# Install dependencies
npm install

# Build the library
npm run build

# Development mode with watch
npm run dev

# Serve examples
npm run serve
# After running serve, open http://localhost:3000/markdowns-peek in your browser

GitHub Actions

This project uses GitHub Actions for continuous integration:

Workflows

  • Tests (test.yml) - Runs tests on Node.js 20.x

Triggers

  • Tests and Lint run on every push to main and pull requests

Status Badges

The README includes a badge showing the status of Tests workflow.

License

LGPL-2.1