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

@markup-carve/carve-components

v0.1.0

Published

React and Vue components that render Carve markup to safe HTML via carve-js

Readme

carve-components

React and Vue 3 components that render Carve markup to safe HTML, powered by carve-js. This fills a gap that the djot ecosystem does not cover: ready-made framework components for rendering the markup.

Install

npm install @markup-carve/carve-components react react-dom   # React
npm install @markup-carve/carve-components vue               # Vue

react / react-dom (>=18) and vue (>=3) are optional peer dependencies. Pull in only the framework you use; the subpath exports keep a React app from ever loading Vue and vice versa.

React

import { Carve, useCarveHtml } from "@markup-carve/carve-components/react";

<Carve source="# Hello\n\n*bold* and /italic/" />
<Carve source={src} as="article" className="prose" options={{ allowRawHtml: true }} />

const html = useCarveHtml(src); // memoized HTML string

<Carve> accepts source (required), options (carve-js options), as (wrapper element, default div), plus any extra props (className, id, style, ...) and a forwarded ref that fall through to the wrapper. The HTML is injected via dangerouslySetInnerHTML.

Vue

<script setup lang="ts">
import { Carve, useCarveHtml } from "@markup-carve/carve-components/vue";
const html = useCarveHtml(() => src);
</script>

<template>
  <Carve :source="src" as="article" :options="{ allowRawHtml: true }" />
</template>

<Carve> accepts :source (required), :options, and :as (default div). The HTML is injected via v-html. Extra attributes fall through to the wrapper.

SSR

Both components are server-render safe: carve-js is isomorphic and there is no window/document access at module scope. Use react-dom/server's renderToString or @vue/server-renderer as usual.

Security model

carve-js sanitizes its own output (the project's defenses are normative), so the rendered HTML is meant to be injected directly. This library does not re-escape it. Two carve-js knobs matter:

  • URL sanitization (sanitizeUrls, carve-js default true, pinned on here): dangerous link/image schemes (javascript:, vbscript:, data:, file:) are blanked to "". The link text / image alt still render but are inert.
  • Raw HTML (allowRawHtml): carve-js defaults this to true to match its conformance corpus, which means the explicit raw-HTML author forms (`…`{=html} inline and ```=html block) emit verbatim and CAN inject a live <script>. This library overrides the default to false so the components are safe by default for untrusted input - raw HTML is escaped to text. A bare <script> line in plain Carve is always escaped regardless of this flag.

If you fully trust the input and want raw-HTML passthrough, pass options={{ allowRawHtml: true }}.

| Hostile input | Default component output | | -------------------------------------- | -------------------------------- | | [x](javascript:alert(1)) | <a href="">x</a> (inert) | | `<script>...`{=html} | escaped text (&lt;script&gt;) | | ```=html block with <script> | escaped text | | bare <script>...</script> line | escaped text |

carve-js dependency (bundled)

carve-js (@markup-carve/carve) is a build-time dependency only: tsup bundles it into this package's dist/ (noExternal), so the published package is self-contained and consumers do not install carve-js separately. It is therefore a devDependency (pinned to a carve-js git commit), not a runtime dependency. Bump the pinned commit in devDependencies and rebuild to pick up a newer engine.