Skip to content

极小的JavaScript Markdown渲染器,具有接近GFM的兼容性。| Minimal JavaScript Markdown renderer with near-GFM compatibility.

License

Notifications You must be signed in to change notification settings

OblivionOcean/MiniGFM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniGFM

Minimal JavaScript Markdown renderer with near-GFM compatibility.

Features

  • Extremely small - With a size barely 3KB (A Brotli compression would be 1.5KB) and zero dependencies
  • GFM compatible (GitHub Flavored Markdown)
  • XSS-safe

Quick Start

Installation

CDN

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

NPM

npm i @oblivionocean/minigfm

Basic Usage

ESModule:

import MiniGFM from '@oblivionocean/minigfm';

const md = new MiniGFM();
console.log(md.parse('# Hello World')); // Outputs: <h1>Hello World</h1>

CommonJS:

const MiniGFM = require('@oblivionocean/minigfm');
const md = new MiniGFM.MiniGFM();
console.log(md.parse('# Hello World')); // Outputs: <h1>Hello World</h1>

Configuration Options

Property Type Description
unsafe boolean Allow raw HTML tags (escaped by default)
hljs object Enable code highlighting (requires hljs instance)
const md = new MiniGFM({
    unsafe: true, // Allow raw HTML rendering
    hljs: hljs,   // Use highlight.js for code blocks
});
console.log(md.parse('# Hello World')); // <h1>Hello World</h1>

Dependencies

Completely dependency-free implementation.

About

极小的JavaScript Markdown渲染器,具有接近GFM的兼容性。| Minimal JavaScript Markdown renderer with near-GFM compatibility.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •