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

vite-plugin-json-md

v0.7.5

Published

Vite plugin for processing markdown in JSON files

Downloads

50

Readme

vite-plugin-json-md

npm version License: MIT

A Vite plugin that processes markdown content in JSON/JSON5 files. Particularly useful for i18n applications where translation files need to store complex HTML markup in JSON format. Instead of writing HTML directly in JSON files, you can use more readable markdown syntax or include external markdown files.

Features

  • Process inline markdown in JSON/JSON5 files
  • Include external markdown files
  • Convert JSON5/JSONC to standard JSON
  • Minification options
  • Perfect for i18n translation files containing rich text content
  • Support for both inline markdown and external markdown files
  • Open links in new tabs with target="_blank" rel="noopener noreferrer"

Installation

# npm
npm install vite-plugin-json-md -D

# yarn
yarn add vite-plugin-json-md -D

# pnpm
pnpm add vite-plugin-json-md -D

Usage

Basic Configuration

Add the plugin to your vite.config.js:

import { defineConfig } from 'vite'
import { jsonMdPlugin } from 'vite-plugin-json-md'

export default defineConfig({
  plugins: [
    jsonMdPlugin({
      sourceDir: 'src/locales',
      inputFiles: ['en/*.json5', 'fr/*.json5'],
      markdownDir: 'src/locales/md',
      outputDir: 'src/locales/out',
      parseMarkdown: true,
      convertToJson: true,
      externalLinks: true
    })
  ]
})

Example with i18n

Input translation file (src/locales/en/messages.json5):

{
  "welcome": {
    // Inline markdown
    "title": "md:# Welcome to our platform",
    "description": "md:We offer:\n\n- Feature One\n- Feature Two\n- Feature Three",
    
    // External markdown file
    "privacyPolicy": "md:@legal/privacy-policy.md",
    
    // Regular text (no processing)
    "simpleText": "This is regular text without markdown"
  },
  "pricing": {
    "title": "md:## Flexible Pricing Plans",
    "description": "md:Choose the plan that works best for you:\n\n- Basic: $9/mo\n- Pro: $19/mo\n- Enterprise: Contact us"
  }
}

External markdown file (src/locales/md/legal/privacy-policy.md):

# Privacy Policy

We take your privacy seriously:

1. We collect minimal data
2. Your data is encrypted
3. We never share your information

[Learn more about our terms](/terms)

Output file (src/locales/out/en/messages.json):

{
  "welcome": {
    "title": "<h1>Welcome to our platform</h1>",
    "description": "<ul><li>Feature One</li><li>Feature Two</li><li>Feature Three</li></ul>",
    "privacyPolicy": "<h1>Privacy Policy</h1><p>We take your privacy seriously:</p><ol><li>We collect minimal data</li><li>Your data is encrypted</li><li>We never share your information</li></ol><p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"/terms\">Learn more about our terms</a></p>",
    "simpleText": "This is regular text without markdown"
  },
  "pricing": {
    "title": "<h2>Flexible Pricing Plans</h2>",
    "description": "<p>Choose the plan that works best for you:</p><ul><li>Basic: $9/mo</li><li>Pro: $19/mo</li><li>Enterprise: Contact us</li></ul>"
  }
}

Using with Vue-i18n:

import { createI18n } from 'vue-i18n'
import en from './locales/out/en/messages.json'

const i18n = createI18n({
  messages: { en }
})

export default i18n

Template usage:

<template>
  <div v-html="$t('welcome.title')" />
  <div v-html="$t('welcome.description')" />
  <div v-html="$t('welcome.privacyPolicy')" />
</template>

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | sourceDir | string | "" | Source directory containing JSON/JSON5 files | | inputFiles | string[] | - | Glob patterns for input files | | markdownDir | string | - | Directory containing external markdown files | | outputDir | string | - | Output directory for processed files | | parseMarkdown | boolean | true | Whether to parse markdown into HTML | | convertToJson | boolean | false | Convert JSON5/JSONC to standard JSON | | minify | boolean | false | Minify output files | | externalLinks | boolean | false | Add target="_blank" rel="noopener noreferrer" to all links |

Markdown Processing

  • Inline markdown: Use md: prefix
  • External markdown files: Use md:@filename.md
  • Regular strings: No processing

License

MIT License © 2024 Ruslan Makarov