Minimal JavaScript Markdown renderer with near-GitHub Flavored Markdown compatibility

Just 3KB lightweight
XSS Safe
Zero Dependencies

Key Features

Ultra Lightweight

  • Core size just ~3KB
  • Down to 1.5KB with Brotli compression
  • Zero dependencies, pure JavaScript
  • Fast loading, perfect for web projects

GFM Compatible

  • Supports GitHub Flavored Markdown
  • Renders tables, task lists, and more
  • Automatic link detection
  • Inline code and code block support

Secure & Reliable

  • Built-in XSS protection
  • HTML tags escaped by default
  • Optional unsafe mode available
  • Strict input sanitization

Quick Start

Integrate MiniGFM into your project in just a few steps:

CDN
NPM

Include via CDN:

HTML
<script src="https://cdn.jsdelivr.net/npm/@oblivionOcean/minigfm@latest/dist/index.min.js"></script>

Install via NPM:

Terminal
npm install @oblivionocean/minigfm

Usage in your project:

JavaScript
// Using ESModule
import MiniGFM from '@oblivionocean/minigfm';

// Using CommonJS
const MiniGFM = require('@oblivionocean/minigfm').MiniGFM;

// Create instance and parse Markdown
const md = new MiniGFM();
console.log(md.parse('# Hello World')); // <h1>Hello World</h1>

Live Demo

Markdown Input
Rendered Output

Configuration Options

MiniGFM offers flexible configuration to meet your project's needs.

Property Type Default Description
unsafe boolean false Enable raw HTML tags (beware of XSS risks)
hljs object null Enable code highlighting with highlight.js instance

Configuration Example

JavaScript
// Create configured instance
const md = new MiniGFM({
    unsafe: true, // Allow raw HTML rendering
    hljs: hljs,   // Use highlight.js for code blocks
});

// Parse Markdown
const html = md.parse('# Hello World');
console.log(html); // <h1>Hello World</h1>