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

@snapie/renderer

v0.1.1

Published

Hive blockchain markdown renderer with 3Speak, IPFS, and media embed support

Readme

@snapie/renderer

Hive blockchain markdown renderer with 3Speak, IPFS, and media embed support.

npm version License: MIT

Installation

npm install @snapie/renderer
# or
pnpm add @snapie/renderer
# or
yarn add @snapie/renderer

Features

  • 🎬 3Speak video/audio embeds - Automatic iframe embedding
  • 📁 IPFS content handling - Multiple gateway fallbacks
  • 🔗 Hive URL conversion - Converts peakd, ecency, hive.blog links
  • 🐦 Twitter/X embeds - Embedded tweets support
  • 🛡️ XSS protection - DOMPurify sanitization built-in
  • Isomorphic - Works in Node.js and browser

Quick Start

import { createHiveRenderer, renderHiveMarkdown } from '@snapie/renderer';

// Simple usage with defaults
const html = renderHiveMarkdown('# Hello Hive!\n\nCheck out this video: https://3speak.tv/watch?v=user/video123');

// Custom configuration
const renderer = createHiveRenderer({
  ipfsGateway: 'https://ipfs.skatehive.app',
  convertHiveUrls: true,
  internalUrlPrefix: ''
});

const html = renderer.render('Your markdown content here...');

Usage Examples

Basic Rendering

import { renderHiveMarkdown } from '@snapie/renderer';

const markdown = `
# My Hive Post

Hello **Hive** community! 🚀

Check out this video:
https://3speak.tv/watch?v=skatehive/abcd1234

![My Image](ipfs://QmXxx.../image.jpg)
`;

const html = renderHiveMarkdown(markdown);

With Custom Options

import { createHiveRenderer } from '@snapie/renderer';

const renderer = createHiveRenderer({
  // Primary IPFS gateway
  ipfsGateway: 'https://ipfs.skatehive.app',
  
  // Fallback gateways
  ipfsFallbackGateways: [
    'https://ipfs.3speak.tv',
    'https://cloudflare-ipfs.com',
    'https://ipfs.io'
  ],
  
  // Convert Hive frontend URLs to internal links
  convertHiveUrls: true,
  internalUrlPrefix: '',
  
  // Additional frontends to recognize
  additionalHiveFrontends: ['skatehive.app'],
  
  // Custom user mention URLs
  usertagUrlFn: (account) => `/@${account}`,
  
  // Custom hashtag URLs
  hashtagUrlFn: (hashtag) => `/trending/${hashtag}`,
  
  // Asset dimensions
  assetsWidth: 640,
  assetsHeight: 480
});

const html = renderer.render(markdown);

IPFS Content

import { createIpfsUrl, isIpfsContent, extractIpfsHash } from '@snapie/renderer';

// Create gateway URL from IPFS hash
const url = createIpfsUrl('QmXxx...', 'https://ipfs.skatehive.app');
// => 'https://ipfs.skatehive.app/ipfs/QmXxx...'

// Check if content is IPFS
isIpfsContent('ipfs://QmXxx...');  // true
isIpfsContent('https://ipfs.io/ipfs/QmXxx...');  // true

// Extract hash from various formats
extractIpfsHash('ipfs://QmXxx.../file.jpg');  // 'QmXxx.../file.jpg'

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | 'https://hive.blog/' | Base URL for relative links | | ipfsGateway | string | 'https://ipfs.3speak.tv' | Primary IPFS gateway | | ipfsFallbackGateways | string[] | [skatehive, cloudflare, ipfs.io] | Fallback IPFS gateways | | convertHiveUrls | boolean | true | Convert Hive frontend URLs | | internalUrlPrefix | string | '' | Prefix for internal links | | usertagUrlFn | function | (acc) => '/@' + acc | User mention URL generator | | hashtagUrlFn | function | (tag) => '/trending/' + tag | Hashtag URL generator | | additionalHiveFrontends | string[] | [] | Extra Hive frontends to recognize | | assetsWidth | number | - | Default asset width | | assetsHeight | number | - | Default asset height | | imageProxyFn | function | - | Custom image proxy function |

Supported Embeds

3Speak Videos

https://3speak.tv/watch?v=username/permlink
https://play.3speak.tv/watch?v=username/permlink
https://play.3speak.tv/embed?v=username/permlink

3Speak Audio

https://audio.3speak.tv/play?a=username/audiolink

Twitter/X

https://twitter.com/user/status/123456789
https://x.com/user/status/123456789

IPFS Content

ipfs://QmHash.../path/to/file.jpg
https://ipfs.io/ipfs/QmHash...
https://gateway.pinata.cloud/ipfs/QmHash...

Recognized Hive Frontends

URLs from these frontends are automatically converted:

  • peakd.com
  • ecency.com
  • hive.blog
  • hiveblog.io
  • leofinance.io
  • 3speak.tv
  • d.tube
  • esteem.app
  • busy.org

Security

This package uses DOMPurify to sanitize all HTML output, protecting against:

  • XSS attacks
  • Script injection
  • Malicious iframes
  • Event handler injection

Allowed HTML elements are whitelisted (headings, formatting, tables, media embeds, etc.)

API Reference

Functions

| Function | Description | |----------|-------------| | createHiveRenderer(options?) | Create a configured renderer instance | | renderHiveMarkdown(markdown, options?) | One-shot render with options | | createIpfsUrl(hash, gateway?) | Generate IPFS gateway URL | | isIpfsContent(url) | Check if URL is IPFS content | | extractIpfsHash(url) | Extract IPFS hash from URL |

Types

interface HiveRendererOptions {
  baseUrl?: string;
  ipfsGateway?: string;
  ipfsFallbackGateways?: string[];
  usertagUrlFn?: (account: string) => string;
  hashtagUrlFn?: (hashtag: string) => string;
  additionalHiveFrontends?: string[];
  convertHiveUrls?: boolean;
  internalUrlPrefix?: string;
  assetsWidth?: number;
  assetsHeight?: number;
  imageProxyFn?: (url: string) => string;
}

interface HiveRenderer {
  render(markdown: string): string;
}

Related Packages

License

MIT © Mantequilla-Soft