Version badge plugin

July 5, 2026 ยท View on GitHub

๐Ÿ“ฆ This package has moved. It now lives in the markdown-magic-plugins monorepo at packages/version-badge. This repository is archived; issues and contributions go to the monorepo.

Version badge plugin

Add version badge to markdown files via markdown-magic

Install

npm i markdown-magic markdown-magic-version-badge --save-dev

Adding the plugin

See example.js for usage.

import path from 'path';
import { markdownMagic } from 'markdown-magic';
import VERSIONBADGE from './index.js';

const config = {
  matchWord: 'AUTO-GENERATED-CONTENT',
  transforms: {
    VERSIONBADGE,
  },
};

const markdownPath = path.join(import.meta.dirname, 'README.md');
await markdownMagic(markdownPath, config);

Usage in markdown

npm

Options

  • pkg (nearest package.json file in file tree from the README by default) - path to closest pkg
  • link (links to npm by default) - a URL to link the button to (set to false to prevent link)
  • prefix (npm by default) - the prefix for the badge
  • color (green by default or orange if pre-release version) - any supported color