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

@ -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

View File

@ -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**