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-inline-svg-flex

v0.3.8

Published

Flexible Remark plugin that inlines and optimizes SVGs with SVGO, featuring customizable path resolution and wrappers.

Downloads

933

Readme

⚠️ Beta Nearing v1.0.0 — APIs may still change slightly.

remark-inline-svg-flex

Downloads version MIT License

Flexible Remark plugin that inlines and optimizes SVGs with SVGO, featuring customizable path resolution, wrappers and others.

Features

✔️ Robust and customizable path resolution

  • If the SVG path is absolute, it is used as-is.
  • If the path is relative and assetsDir is defined, it is resolved relative to that directory.
  • Otherwise, the path is resolved relative to the Markdown file’s location.

✔️ Custom HTML wrapper support

Use your own custom HTML wrapper, no wrapper at all, or the default:

<figure class="inline-svg"></figure>

✔️ Optional SVG optimization

SVG optimization can be disabled if needed e.g. if SVGO removes required attributes.

✔️ Configurable suffix

By default, only files ending in .svg are processed. You can customize the suffix to suit your needs.

Installation

npm i remark-inline-svg-flex

Usage

Say we have the following file example.md:

# Hello

This is a test markdown document.

![some svg](some.svg)

And our module example.js looks as the one below (it is recommended to pass the markdown directory path to process() so that the plugin can resolve relative paths correctly).

import { remark } from 'remark';
import { readFile } from 'node:fs/promises';
import { remarkInlineSvg } from 'remark-inline-svg-flex';

const markdown = await readFile(_path, { encoding: 'utf8' });

return await remark()
  .use(remarkParse)
  .use(remarkInlineSvg)
  .process({ value: markdown, path: _path });

Now running node example.js yields:

# Hello

This is a test markdown document.

<figure class="inline-svg">
  <svg width="800" height="800" fill="none" viewBox="0 0 16 16">
  ...
  </svg>
</figure>

Options

| Key | type | Default value | Description | | ------------------------- | --------------------- | ---------------------------------------- | ---------------------------------------------------------- | | suffix | string | '.svg' | The plugin only processes SVG files ending with this value | | assetsDir | string \| undefined | undefined | Base directory where SVG files are located | | wrapper | string | '<figure class="inline-svg"></figure>' | HTML wrapper used to wrap the inlined SVG | | svgo | boolean | true | Enable or disable SVG optimization |

suffix

Only image nodes whose URL ends with the specified suffix will be processed. Defaults to '.svg'.

assetsDir

Base directory where SVG files are located. By default is undefined and it will resolve paths either in an absolute or relative manner.

wrapper

Defines the HTML wrapper used around the inlined SVG.

  • Set to an empty string '' to disable wrapping entirely.
  • Defaults to:
<figure class="inline-svg"></figure>

svgo

The SVG's are optimized by default. Disable it by setting it to false.

SVGO configuration

{ plugins: ['preset-default', 'removeXMLNS'] }