UNPKG

2.68 kBMarkdownView Raw
1<a href="https://marked.js.org">
2 <img width="60px" height="60px" src="https://marked.js.org/img/logo-black.svg" align="right" />
3</a>
4
5# Marked
6
7[![npm](https://badgen.net/npm/v/marked)](https://www.npmjs.com/package/marked)
8[![gzip size](https://badgen.net/badgesize/gzip/https://cdn.jsdelivr.net/npm/marked/marked.min.js)](https://cdn.jsdelivr.net/npm/marked/marked.min.js)
9[![install size](https://badgen.net/packagephobia/install/marked)](https://packagephobia.now.sh/result?p=marked)
10[![downloads](https://badgen.net/npm/dt/marked)](https://www.npmjs.com/package/marked)
11[![github actions](https://github.com/markedjs/marked/workflows/Tests/badge.svg)](https://github.com/markedjs/marked/actions)
12[![snyk](https://snyk.io/test/npm/marked/badge.svg)](https://snyk.io/test/npm/marked)
13
14- ⚡ built for speed
15- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
16- ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications
17- 🌐 works in a browser, on a server, or from a command line interface (CLI)
18
19## Demo
20
21Checkout the [demo page](https://marked.js.org/demo/) to see marked in action ⛹️
22
23## Docs
24
25Our [documentation pages](https://marked.js.org) are also rendered using marked 💯
26
27Also read about:
28
29* [Options](https://marked.js.org/#/USING_ADVANCED.md)
30* [Extensibility](https://marked.js.org/#/USING_PRO.md)
31
32## Compatibility
33
34**Node.js:** Only [current and LTS](https://nodejs.org/en/about/releases/) Node.js versions are supported. End of life Node.js versions may become incompatible with Marked at any point in time.
35
36**Browser:** Not IE11 :)
37
38## Installation
39
40**CLI:** `npm install -g marked`
41
42**In-browser:** `npm install marked`
43
44## Usage
45
46### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
47
48**CLI**
49
50``` bash
51$ marked -o hello.html
52hello world
53^D
54$ cat hello.html
55<p>hello world</p>
56```
57
58**Browser**
59
60```html
61<!doctype html>
62<html>
63<head>
64 <meta charset="utf-8"/>
65 <title>Marked in the browser</title>
66</head>
67<body>
68 <div id="content"></div>
69 <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
70 <script>
71 document.getElementById('content').innerHTML =
72 marked('# Marked in the browser\n\nRendered by **marked**.');
73 </script>
74</body>
75</html>
76```
77
78## License
79
80Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)