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 | ## 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 |
|
51 | ``` bash
|
52 | # Example with stdin input
|
53 | $ marked -o hello.html
|
54 | hello world
|
55 | ^D
|
56 | $ cat hello.html
|
57 | <p>hello world</p>
|
58 | ```
|
59 |
|
60 | ```bash
|
61 | # Print all options
|
62 | $ marked --help
|
63 | ```
|
64 |
|
65 | **Browser**
|
66 |
|
67 | ```html
|
68 | <!doctype html>
|
69 | <html>
|
70 | <head>
|
71 | <meta charset="utf-8"/>
|
72 | <title>Marked in the browser</title>
|
73 | </head>
|
74 | <body>
|
75 | <div id="content"></div>
|
76 | <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
77 | <script>
|
78 | document.getElementById('content').innerHTML =
|
79 | marked.parse('# Marked in the browser\n\nRendered by **marked**.');
|
80 | </script>
|
81 | </body>
|
82 | </html>
|
83 | ```
|
84 |
|
85 | ## License
|
86 |
|
87 | Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|