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 |
|
21 | Checkout the [demo page](https://marked.js.org/demo/) to see marked in action ⛹️
|
22 |
|
23 | ## Docs
|
24 |
|
25 | Our [documentation pages](https://marked.js.org) are also rendered using marked 💯
|
26 |
|
27 | Also read about:
|
28 |
|
29 | * [Options](https://marked.js.org/#/USING_ADVANCED.md)
|
30 | * [Extensibility](https://marked.js.org/#/USING_PRO.md)
|
31 |
|
32 | ## Installation
|
33 |
|
34 | **CLI:** `npm install -g marked`
|
35 |
|
36 | **In-browser:** `npm install marked`
|
37 |
|
38 | ## Usage
|
39 |
|
40 | ### 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! 🚨
|
41 |
|
42 | **CLI**
|
43 |
|
44 | ``` bash
|
45 | $ marked -o hello.html
|
46 | hello world
|
47 | ^D
|
48 | $ cat hello.html
|
49 | <p>hello world</p>
|
50 | ```
|
51 |
|
52 | **Browser**
|
53 |
|
54 | ```html
|
55 | <!doctype html>
|
56 | <html>
|
57 | <head>
|
58 | <meta charset="utf-8"/>
|
59 | <title>Marked in the browser</title>
|
60 | </head>
|
61 | <body>
|
62 | <div id="content"></div>
|
63 | <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
64 | <script>
|
65 | document.getElementById('content').innerHTML =
|
66 | marked('# Marked in the browser\n\nRendered by **marked**.');
|
67 | </script>
|
68 | </body>
|
69 | </html>
|
70 | ```
|
71 |
|
72 | ## License
|
73 |
|
74 | Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|