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

keystone-svelte-renderer

v1.1.1

Published

A Keystonejs document renderer in Svelte 5

Downloads

6

Readme

Keystone Svelte Renderer

This is an unofficial Svelte 5 port of Keystonejs's Document Renderer.

Installation

npm i -D keystone-svelte-renderer

Usage

<script lang="ts">
	import Renderer from 'keystone-svelte-renderer';

	// this should be replaced with your Keystone Document content
	import { content } from './sample-content.js';
</script>

<article class="my-4 px-8">
	<Renderer document={content.document}></Renderer>
</article>

Styling

Currently styling is left to the user. The library is only concerned with rendering they Keystone document to the DOM.

Here's a sample style for the above code.

<style lang="postcss">
	article :global {
		h1 {
			@apply my-4 scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl;
		}

		h2 {
			@apply my-4 scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0;
		}

		h3 {
			@apply my-3 scroll-m-20 text-2xl font-semibold tracking-tight;
		}

		h4 {
			@apply my-2 scroll-m-20 text-xl font-semibold tracking-tight;
		}

		h5 {
			@apply my-2 scroll-m-20 text-lg font-medium tracking-tight;
		}

		h6 {
			@apply my-2 scroll-m-20 font-medium tracking-tight;
		}

		p {
			@apply leading-7 [&:not(:first-child)]:mt-6;
		}

		em {
			@apply italic;
		}

		u {
			@apply underline;
		}

		strong {
			@apply font-bold;
		}

		s {
			@apply line-through;
		}

		sub {
			@apply text-sm;
		}

		sup {
			@apply text-sm;
		}

		a {
			@apply font-medium underline underline-offset-4;
		}

		ul {
			@apply my-6 ml-6 list-disc [&>li]:mt-2;
		}

		ol {
			@apply my-6 ml-6 list-decimal [&>li]:mt-2;
		}

		blockquote {
			@apply mt-6 border-l-2 pl-6 italic;
		}
	}
</style>

Experimental

You can override the default renderers.

<!-- CustomParagraph.svelte -->
<script lang="ts">
	import type { Snippet } from 'svelte';

	interface Props {
		children?: Snippet;
		[key: string]: unknown;
	}

	let { tag, children, ...restAttributes }: Props = $props();
</script>

<!-- your paragraph with some custom styling -->
<p class="text-red-500" {...restAttributes}>
	{@render children?.()}
</p>
<script lang="ts">
	import Renderer, { defaultRenderer } from 'keystone-svelte-renderer';
  import CustomParagraph from './CustomParagraph.svelte'

  // override the paragraph's renderer
  const customRenderer== {
    ...defaultRenderers
    paragraph: CustomParagraph
  } 

	// this should be replaced with your Keystone Document content
	import { content } from './sample-content.js';
</script>

<article class="my-4 px-8">
	<Renderer document={content.document} renderers={customRenderers}></Renderer>
</article>

Node types that can be overridden

| Node type | Additional Attributes | Default Tag | | ----------------- | --------------------- | ----------------------- | | bold | | strong | | italic | | em | | underline | | u | | strikethrough | | s | | code | | code | | keyboard | | kbd | | subscript | | sub | | superscript | | sup | | relationship | | span | | link | | a | | blockquote | | blockquote | | heading | node.level | h | | paragraph | node.textAlign | p | | layout | node.layout | div | | layout-area | | div | | divider | | hr | | ordered-list | | ol | | unordered-list | | ul | | list-item | | li | | list-item-content | | null (is a text node) |

Node types (or custom components) outside the above list are not supported as of now.