Skip to content

Modern-IE/Marked

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Marked for IE6 📜

A drop-in, zero-dependency Markdown parser designed specifically to run natively on the JScript 5.8 engine of Internet Explorer 6.

It preserves the standard marked API, so you can swap out modern marked in your legacy enterprise projects without changing your implementation logic!

Features Supported

Despite being constrained to ES3 JavaScript and overcoming IE6's regex bugs, this engine supports:

  • Headers: # H1 to ###### H6
  • Emphasis: bold, *italic*, ~~strikethrough~~
  • Lists: Unordered (-, *, +) and Ordered (1.)
  • Links & Images: [text](url) and ![alt](url)
  • Blockquotes: > To be, or not to be
  • Code: Inline `code` and Fenced blocks (```)
  • Standard API: Drop-in compatibility with marked.parse and marked.setOptions.

Installation & Usage

  1. Include the single JavaScript file in your document:
<script type="text/javascript" src="marked-ie6.js"></script>
  1. Use it exactly like the modern marked library:

Basic Parsing

// Method 1: Direct call
var html = marked('# Hello IE6');

// Method 2: .parse method
var html2 = marked.parse('Bold text');

Passing Options

You can pass options locally per call, or globally using setOptions:

// Global options
marked.setOptions({
    breaks: true,    // Convert \n to <br>
    sanitize: false  // Escape HTML tags
});

var content = "Line 1\nLine 2";
document.getElementById('content').innerHTML = marked(content); 
// Output: <p>Line 1<br>Line 2</p>

// Local options overrides global
var output = marked.parse("<h1>Stop!</h1>", { sanitize: true });
// Output: <p>&lt;h1&gt;Stop!&lt;/h1&gt;</p>

Why this exists?

If you try to load the modern marked.js in IE6, it will crash immediately due to const, let, Arrow Functions, and lack of standard trim() or modern RegExp flags.

This script rewrites the Markdown parsing logic using a heavily optimized Cascading Regular Expression approach tailored for JScript 5.8 limits. Fenced code blocks are isolated prior to parsing to prevent syntax conflicts, ensuring decent performance without triggering IE6's "Slow Script" warning.

License

MIT

About

Marked support designed for Internet Explorer 6

Topics

Resources

License

Stars

Watchers

Forks

Contributors