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

remark-plantuml-local

v1.3.3

Published

`remark-plantuml-local` is a plugin for [remarkjs](https://github.com/remarkjs/remark) that converts PlantUML code blocks to local image files with support for including .puml files.

Readme

Remark PlantUML Local Plugin

Build Status MIT License

remark-plantuml-local is a plugin for remarkjs that converts PlantUML code blocks to local image files. The plugin supports including external .puml files and can store generated images locally or inline SVG content.

Installing

npm install --save remark-plantuml-local

Example

You can use this plugin like following

Markdown

# Your markdown including PlantUML code block

```plantuml Your title
class SimplePlantUMLPlugin {
    + transform(syntaxTree: AST): AST
}
```

# Including external .puml files

```plantuml
!include diagram.puml

class MainClass {
    + main(): void
}
```

JavaScript

const remark = require("remark");
const plantumlLocal = require("remark-plantuml-local");
const fs = require("fs");
const path = require("path");

const input = fs.readFileSync(path.resolve(__dirname, "./your-markdown.md")).toString();
const output = await remark().use(plantumlLocal).process(input);

console.log(output.toString());
// will generate local image files or inline SVG content

Plugin Options

The plugin supports various configuration options:

const options = {
  baseUrl: "https://www.plantuml.com/plantuml", // PlantUML server URL
  outputFormat: "png", // "png" or "svg"
  outputDir: "./static", // Directory to store generated images
  inlineImage: false, // Whether to inline images (SVG as HTML, PNG as PlantUML server URLs)
  includePath: "./", // Base path for resolving included .puml files
  urlPrefix: "/" // URL prefix to replace "./" in generated image URLs
};

remark().use(simplePlantUML, options).process(input);

Option Details

  • baseUrl: The PlantUML server URL (default: https://www.plantuml.com/plantuml)
  • outputFormat: Output format for diagrams - "png" or "svg" (default: "png")
  • outputDir: Directory where generated images will be stored (default: "./static")
  • inlineImage: When true, inlines images as PlantUML server URLs instead of creating local files. Works for both SVG and PNG formats (default: false)
  • includePath: Base path for resolving !include directives in PlantUML code (default: "./")
  • urlPrefix: URL prefix to replace "./" in generated image URLs (default: "/")

Example: Customizing the Public URL for Images

If your static files are served from a different public path than where they are generated, use urlPrefix:

const options = {
  outputDir: "./static/diagrams", // Where files are saved
  urlPrefix: "/assets/diagrams/", // How files are referenced in HTML
  outputFormat: "png"
};

remark().use(plantumlLocal, options).process(input);

This will save images to ./static/diagrams/plantuml-xxxx.png and reference them as /assets/diagrams/plantuml-xxxx.png in your HTML output.

  • By default, urlPrefix is /, so images will be referenced from the web root (e.g., /plantuml-xxxx.png).
  • No double slashes or directory leaks will occur in the generated URLs.

Features

Include External .puml Files

The plugin supports PlantUML's !include directive for .puml files:

!include common-styles.puml
!include diagram.puml

class MyClass {
    + method(): void
}

Local Image Storage

Instead of using external PlantUML URLs, the plugin fetches the generated images and stores them locally in the specified outputDir.

Filenames are based on a SHA-256 hash of the PlantUML code, ensuring that each unique diagram gets a unique filename. This also means that if you use the same diagram code in multiple places, the image will only be generated and stored once.

Built-in caching: Before writing a file, the plugin checks if it already exists. If so, it reuses the existing file and does not regenerate or duplicate the image on disk.

Inline SVG Support

When using SVG format with `