Skip to content

Commit

Permalink
docs: add docs for esm in browser (#3107)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Nov 28, 2023
1 parent daef1a5 commit 4f33040
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ Also read about:

## Installation

**CLI:**
**CLI:**

```sh
```sh
npm install -g marked
```

**In-browser:**
**In-browser:**

```sh
npm install marked
Expand Down Expand Up @@ -92,6 +92,15 @@ $ marked --help
</body>
</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

Expand Down
9 changes: 9 additions & 0 deletions docs/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ $ marked -s 'line1\nline2' -c config.json
</body>
</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**

Expand Down

1 comment on commit 4f33040

@vercel
Copy link

@vercel vercel bot commented on 4f33040 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.