Skip to main content

Installation

Remarklet can be installed as an NPM package or used via a CDN. It can also be used as a bookmarklet in your browser, allowing for quick access to its features on public web pages.

Module

To install Remarklet as a module, choose one of the following package managers:

npm install @zw/remarklet

Then import the module in your JavaScript file:

import remarklet from "@zw/remarklet";
// Optional: configure the library.
remarklet.options({
persist: true, // default: false.
hide: true, // default: false.
});
// Optional: use a button to deactivate the library.
document.body.addEventListener("click", function(e) {
if ("deactivate" === e.target.id) {
remarklet.deactivate();
}
}, { capture: true });
remarklet.activate();

CDN

Remarklet is available from:

  • unpkg: https://unpkg.com/@zw/remarklet/dist/remarklet.min.js
  • jsdelivr: https://cdn.jsdelivr.net/npm/@zw/remarklet/dist/remarklet.min.js

Add the following code to your HTML file:

<script src="https://unpkg.com/@zw/remarklet/dist/remarklet.min.js"></script>
<script>
// Optional: configure the library.
remarklet.options({
persist: true, // default: false.
hide: true, // default: false.
});
// Optional: use a button to deactivate the library.
document.body.addEventListener("click", function(e) {
if ("deactivate" === e.target.id) {
remarklet.deactivate();
}
}, { capture: true });
remarklet.activate();
</script>