Get started with marked-base-url CDN

MIT licensed

JS utility: sets base URL for Markdown links during rendering.

Tags:
  • marked
  • extension
  • base
  • url

Stable version

Copied!

How to start using marked-base-url CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with marked-base-url CDN - cdnhub.io</title>
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  <script src="https://cdn.cdnhub.io/marked-base-url/1.1.3/index.umd.min.js"></script>
  <script>
    const marked = require('marked');
    marked.setOptions({
      baseUrl: 'https://cdn.cdnhub.io/marked-base-url/1.1.3/' // Set the base URL for asset references
    });

    const markdownText = `
# Heading
**Bold text**
_Italic text_
> Blockquote

[Link](https://example.com)
![Image](https://cdn.cdnhub.io/image.jpg)
    `;

    const renderedMarkdown = marked(markdownText);
    document.body.innerHTML = renderedMarkdown;
  </script>
</head>
<body></body>
</html>
Copied!
Copied!

All versions