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

memos-embed

v0.4.3

Published

Core HTML renderer and iframe helpers for embedding Memos memo cards.

Readme

memos-embed

Core embed utilities for Memos.

Install

pnpm add memos-embed

What it includes

  • fetchMemo / fetchMemos for loading and normalizing memo data from a Memos instance
  • renderMemoHtml / renderMemoHtmlSnippet for generating themed embed markup
  • renderMemoListHtml / renderMemoListHtmlSnippet for note collections, digests, and roundups with shared styles
  • buildEmbedCss for extracting the shared styles
  • buildEmbedUrl / renderIframeHtml for iframe-based embeds, including optional auto-resize support

Base URL handling

baseUrl accepts any of these forms and normalizes them internally:

  • https://demo.usememos.com
  • https://demo.usememos.com/api
  • https://demo.usememos.com/api/v1

Use whichever shape you already have. The client will resolve memo and user requests against /api/v1 automatically.

Usage

Fetch a memo

import { fetchMemo } from 'memos-embed'

const memo = await fetchMemo({
  baseUrl: 'https://demo.usememos.com',
  memoId: '1',
})

Render a complete HTML snippet

import { fetchMemo, renderMemoHtmlSnippet } from 'memos-embed'

const memo = await fetchMemo({
  baseUrl: 'https://demo.usememos.com/api/v1',
  memoId: '1',
})

const html = renderMemoHtmlSnippet(memo, {
  includeStyles: true,
  theme: 'minimal',
  density: 'comfortable',
  showTags: true,
  showAttachments: true,
  showReactions: true,
  showMeta: true,
  linkTarget: '_blank',
})

Render HTML only and inject your own styles

import { buildEmbedCss, fetchMemo, renderMemoHtml } from 'memos-embed'

const memo = await fetchMemo({
  baseUrl: 'https://demo.usememos.com/api/v1',
  memoId: '1',
})

const css = buildEmbedCss()
const html = renderMemoHtml(memo, {
  theme: 'light',
  locale: 'en',
})

Build an iframe URL or HTML wrapper

import { buildEmbedUrl, renderIframeHtml } from 'memos-embed'

const src = buildEmbedUrl({
  embedBaseUrl: 'https://your-site.com',
  baseUrl: 'https://demo.usememos.com/api/v1',
  memoId: '1',
})

const iframe = renderIframeHtml({
  embedBaseUrl: 'https://your-site.com',
  baseUrl: 'https://demo.usememos.com/api/v1',
  memoId: '1',
  title: 'Memos Embed',
  height: 320,
  autoResize: true,
  sandbox: 'allow-scripts allow-same-origin',
  referrerPolicy: 'strict-origin-when-cross-origin',
})

When autoResize is enabled, renderIframeHtml() also makes sure the iframe id and the forwarded frameId query param stay in sync. If you build the iframe markup yourself with buildEmbedUrl(), make sure those values match on both sides of the handshake or the resize listener will ignore the message.

In multi-embed pages, prefer giving each iframe its own stable frameId.

const iframe = renderIframeHtml({
  embedBaseUrl: 'https://your-site.com',
  baseUrl: 'https://demo.usememos.com/api/v1',
  memoId: '1',
  frameId: 'weekly-note-hero',
  autoResize: true,
})

Fetch a roundup and render a memo list

import { fetchMemos, renderMemoListHtmlSnippet } from 'memos-embed'

const memos = await fetchMemos({
  baseUrl: 'https://demo.usememos.com/api/v1',
  memoIds: ['1', '2', '3'],
})

const html = renderMemoListHtmlSnippet(memos, {
  layout: 'grid',
  gap: '20px',
  theme: 'paper',
})

Create a shared client

import { createMemoClient } from 'memos-embed'

const client = createMemoClient()

await Promise.all([
  client.fetchMemo({ baseUrl: 'https://demo.usememos.com/api/v1', memoId: '1' }),
  client.fetchMemos({ baseUrl: 'https://demo.usememos.com/api/v1', memoIds: ['1', '2'] }),
])

Use a shared client when multiple embeds on one page should reuse memo and creator fetches.

Custom blog theming

import { extendTheme, renderMemoHtmlSnippet } from 'memos-embed'

const blogTheme = extendTheme('minimal', {
  fontFamily: 'inherit',
  radius: 'var(--radius)',
  tokens: {
    background: 'var(--card)',
    foreground: 'var(--card-foreground)',
    mutedForeground: 'var(--muted-foreground)',
    border: 'var(--border)',
    accent: 'var(--primary)',
    accentForeground: 'var(--primary-foreground)',
    codeBackground: 'var(--muted)',
  },
})

const html = renderMemoHtmlSnippet(memo, {
  theme: blogTheme,
})

Use includeStyles: false when you want to provide all CSS yourself.

Render behavior

The renderer supports:

  • headings, lists, task lists, quotes, inline code, links, and fenced code blocks
  • image previews for attachment URLs
  • grouped reaction counts
  • optional postMessage-based iframe auto-resize
  • stack or grid list rendering for multi-memo pages
  • theme presets: minimal, glass, paper, midnight, terminal
  • extendTheme() for blog-aligned design tokens and CSS variable-based theming