UNPKG

2.63 kB Markdown View 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[![dep](https://badgen.net/david/dep/markedjs/marked?label=deps)](https://david-dm.org/markedjs/marked)
12[![dev dep](https://badgen.net/david/dev/markedjs/marked?label=devDeps)](https://david-dm.org/markedjs/marked?type=dev)
13[![travis](https://badgen.net/travis/markedjs/marked)](https://travis-ci.org/markedjs/marked)
14[![snyk](https://snyk.io/test/npm/marked/badge.svg)](https://snyk.io/test/npm/marked)
15
16- ⚡ built for speed
17- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
18- ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications
19- 🌐 works in a browser, on a server, or from a command line interface (CLI)
20
21## Demo
22
23Checkout the [demo page](https://marked.js.org/demo/) to see marked in action ⛹️
24
25## Docs
26
27Our [documentation pages](https://marked.js.org) are also rendered using marked 💯
28
29Also read about:
30
31* [Options](https://marked.js.org/#/USING_ADVANCED.md)
32* [Extensibility](https://marked.js.org/#/USING_PRO.md)
33
34## Installation
35
36**CLI:** `npm install -g marked`
37
38**In-browser:** `npm install marked`
39
40## Usage
41
42### 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! 🚨
43
44**CLI**
45
46``` bash
47$ marked -o hello.html
48hello world
49^D
50$ cat hello.html
51<p>hello world</p>
52```
53
54**Browser**
55
56```html
57<!doctype html>
58<html>
59<head>
60 <meta charset="utf-8"/>
61 <title>Marked in the browser</title>
62</head>
63<body>
64 <div id="content"></div>
65 <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
66 <script>
67 document.getElementById('content').innerHTML =
68 marked('# Marked in the browser\n\nRendered by **marked**.');
69 </script>
70</body>
71</html>
72```
73
74## License
75
76Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)