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

rehype-jsoncanvas

v0.1.7

Published

rehype plugin to render inline json-canvas elements

Downloads

12

Readme

rehype-jsoncanvas

NOTE: This project is currently in active development/prove of concept stage and isn't usable in a project. But feel free to fork, PR, or add issues if you have requests and I will respond quickly.

Its up on NPM but might not work in your environment/context. Let me know if so

Finally, I know it doesn't work on react-markdown atm because it doesn't support async plugins. I'm going to try and fix this, but suggest using the unified ecosystem directly.

What does this do?

A rehype plugin that renders a json-canvas element, probably downstream from a markdown file.

Rendered Canvas inside of Obsidian

Rendered canvas as svg on next shims

Why does it do it?

Because I really like the obsidian json-canvas format, and would like to leverage it a bit more simply in my websites.

Rehype is a toolkit in the unified.js ecosystem that works to parse html trees and manipulate specific elements from those trees. It works well with Markdown and html, and so is perfect for this use case. Becuse the Obsidian ecosystem is primarily markdown, building something like this in the unified ecosystem makes sense.

How does it do it?

Parses the html content (If it's from markdown, usually after the markdown has been translates), then renders a canvas

Install and Use

However you use NPM, basically

npm i rehype-jsoncanvas

And then import it

import rehypeJsonCanvas from "rehype-jsoncanvas"

Then use it however you use rehype plugins.

This is an example of using Unified to render out the base.md markdown. Basically you need to process the markdown first, then transform the markdown rehype. The plugin will then look for rendered images with a .canvas extension to render out the jsonCanvas.

const md = await unified()
  .use(parser)
  .use(mdast2hast)
  .use(remarkGfm)
  .use(remarkRehype)
  .use(rehypeJsonCanvas, { assetPath: "public" })
  .use(compiler, production)
  .process(markdown);

See base.md for an examples. A simple react app lives in this repo to see how it might be used.

References along the way

  • https://github.com/wujieli0207/vue-json-canvas
  • https://github.com/JS-DevTools/rehype-inline-svg
  • https://github.com/trbndev/jsoncanvas
  • https://github.com/Digital-Tvilling/react-jsoncanvas