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

@knowvah/dot-core

v2.0.0

Published

Framework-agnostic Graphviz DOT → SVG render engine for static-site plugins, powered by the pure-TypeScript @knowvah/dot-engine.

Readme

@knowvah/dot-core

The framework-agnostic Graphviz DOT → SVG render engine that powers the @knowvah/*-plugin-dot adapters (VitePress, Eleventy, Docusaurus). Pure TypeScript, powered by @knowvah/dot-engine.

You usually consume one of the adapters, not this package directly — but it's public so you can build your own adapter for any generator.

Install

npm i @knowvah/dot-core @knowvah/dot-engine

@knowvah/dot-engine is a peer dependency.

Entry points

| Import | Environment | Exports | | --- | --- | --- | | @knowvah/dot-core | Node / build | renderDotHtml, resolveConfig, parseFenceInfo, normalizeEngine, escapeHtml, toInlineSvg, currentColorRemap, types | | @knowvah/dot-core/browser | browser | renderDiagram (async DOT → { svg } | { error }) | | @knowvah/dot-core/element | browser | <dot-diagram> custom element + defineDotDiagram() |

Build-time render (Node)

import { renderDotHtml, resolveConfig } from '@knowvah/dot-core';

const cfg = resolveConfig({ useCurrentColor: true });
const html = renderDotHtml('digraph { a -> b }', 'dot', cfg);
// -> '<div class="dot-diagram"><svg …></svg></div>'  (or an error panel)

renderDotHtml strips the standalone-SVG prolog for valid inline embedding and, when resolveConfig({ timeout }) is set, renders in a child process so a pathological graph aborts to an error panel instead of hanging the build.

Client-side render (browser)

import { renderDiagram } from '@knowvah/dot-core/browser';
const { svg, error } = await renderDiagram('digraph { a -> b }', 'dot', false);

Or drop in the framework-neutral custom element:

import { defineDotDiagram } from '@knowvah/dot-core/element';
defineDotDiagram(); // registers <dot-diagram>
<dot-diagram graph="digraph%20%7B%20a%20-%3E%20b%20%7D" use-current-color></dot-diagram>

The graph attribute is URI-encoded DOT source, engine picks the layout engine, wrapper-class overrides the CSS class, and the boolean use-current-color remaps black → currentColor.

Angular (and any framework with custom-element support)

<dot-diagram> works anywhere custom elements do — Angular, Svelte, Solid, plain HTML. In Angular, register it once and allow the tag with CUSTOM_ELEMENTS_SCHEMA:

import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { defineDotDiagram } from '@knowvah/dot-core/element';

defineDotDiagram(); // registers <dot-diagram> once

@Component({
  standalone: true,
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `<dot-diagram [attr.graph]="encodedDot" engine="dot"></dot-diagram>`,
})
export class DiagramComponent {
  // Encode so any DOT source (spaces, %, quotes) survives the attribute.
  readonly encodedDot = encodeURIComponent('digraph { a -> b }');
}

Import @knowvah/dot-core's .dot-diagram styles (or your own) for overflow/centering.

One-shot render: the element renders once when it connects to the DOM and does not observe later attribute changes. For a graph that changes at runtime, have Angular destroy and recreate the element when the source changes — e.g. gate it behind @if (or *ngIf) and toggle, or key it in an @for/*ngFor whose trackBy returns the DOT string — rather than mutating graph in place.

Options (DotPluginOptions)

renderLanguage, mode (build | client), defaultEngine, wrapperClass, timeout (ms; build-mode child-process safe-mode), onError (panel | throw), useCurrentColor. parseFenceInfo reads per-block overrides from a fence info-string (engine=neato, no-render, client / build).

Engine names are case-insensitive. They are normalized (trimmed + lowercased) at every entry point — parseFenceInfo, resolveConfig, and both render functions — so engine=Neato, NEATO, and neato are equivalent wherever an engine is accepted. normalizeEngine(name) is exported for reuse.

Stability

As of 1.0, this package follows semantic versioning: the documented public API is stable, and breaking changes will bump the major version.

License

MIT © Knowvah