@markedts/markedit
v0.1.4
Published
A markdown parser built for speed (fork from marked)
Downloads
9
Readme
MarkedIt
- ⚡ built for speed
- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
- ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications
- 🌐 works in a browser, on a server, or from a command line interface (CLI)
Demo
Checkout the demo page to see markedit in action ⛹️
Docs
Our documentation pages are also rendered using markedit 💯
Also read about:
Compatibility
Node.js: Only current and LTS Node.js versions are supported. End of life Node.js versions may become incompatible with MarkedIt at any point in time.
Browser: Not IE11 :)
Installation
CLI:
npm install -g marked-it
In-browser:
npm install marked-it
Usage
Warning: 🚨 MarkedIt does not sanitize the output HTML. Please use a sanitize library, like DOMPurify (recommended), sanitize-html or insane on the output HTML! 🚨
DOMPurify.sanitize(markedit.parse(`<img src="x" onerror="alert('not happening')">`));
CLI
# Example with stdin input
$ markedit -o hello.html
hello world
^D
$ cat hello.html
<p>hello world</p>
# Print all options
$ markedit --help
Browser
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>MarkedIt in the browser</title>
</head>
<body>
<div id="content"></div>
<script src="https://cdn.jsdelivr.net/npm/markedit/markedit.min.js"></script>
<script>
document.getElementById('content').innerHTML =
markedit.parse('# MarkedIt in the browser\n\nRendered by **markedit**.');
</script>
</body>
</html>
or import esm module
<script type="module">
import { markedit } from "https://cdn.jsdelivr.net/npm/markedit/lib/markedit.esm.js";
document.getElementById('content').innerHTML =
markedit.parse('# MarkedIt in the browser\n\nRendered by **markedit**.');
</script>
License
Copyright (c) 2024, 0xJWLabs. (MIT License)