marked-base-url
TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

marked-base-url

Prefix relative url with base url.

Usage

// ESM
import {marked} from "marked";
import {baseUrl} from "marked-base-url";

marked.use(baseUrl("https://example.com/folder/"));
const html = marked.parse("[my url](./relative/path)");
// <p><a href="https://example.com/folder/relative/path">my url</a></p>

// BROWSER
<script src="https://cdn.jsdelivr.net/npm/marked"></script>
<script src="https://cdn.jsdelivr.net/npm/marked-base-url"></script>
<script>
    marked.use(markedBaseUrl.baseUrl("https://example.com/folder/"));
    const html = marked.parse("[my url](./relative/path)");
    // <p><a href="https://example.com/folder/relative/path">my url</a></p>
</script>

Package Sidebar

Install

npm i marked-base-url

Weekly Downloads

1,171

Version

1.1.4

License

MIT

Unpacked Size

8.19 kB

Total Files

7

Last publish

Collaborators

  • tonybrix