docs: add docs for esm in browser (#3107)

This commit is contained in:
Tony Brix 2023-11-28 08:12:06 -07:00 committed by GitHub
parent daef1a5140
commit 4f3304018e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -37,13 +37,13 @@ Also read about:
## Installation ## Installation
**CLI:** **CLI:**
```sh ```sh
npm install -g marked npm install -g marked
``` ```
**In-browser:** **In-browser:**
```sh ```sh
npm install marked npm install marked
@ -92,6 +92,15 @@ $ marked --help
</body> </body>
</html> </html>
``` ```
or import esm module
```html
<script type="module">
import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
document.getElementById('content').innerHTML =
marked.parse('# Marked in the browser\n\nRendered by **marked**.');
</script>
```
## License ## License

View File

@ -117,6 +117,15 @@ $ marked -s 'line1\nline2' -c config.json
</body> </body>
</html> </html>
``` ```
or import esm module
```html
<script type="module">
import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
document.getElementById('content').innerHTML =
marked.parse('# Marked in the browser\n\nRendered by **marked**.');
</script>
```
**Node.js** **Node.js**