npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

highlightjs-clipboard-toastr

v1.0.0

Published

Auto-enhanced code blocks with Highlight.js, clipboard copy and Toastr notifications

Readme

📋 highlightjs-clipboard-toastr

Una extensión sencilla y personalizable para añadir botones de copiar con notificaciones toastr a bloques de código resaltado con highlight.js.

Ideal para documentaciones, blogs técnicos o cualquier sitio que muestre bloques de código y quiera mejorar la experiencia del usuario al copiar fragmentos.


📦 Requisitos

Este paquete depende de:

🔁 Opcional:


🚀 Instalación

✅ Opción 1: Usando NPM (Import + Bundler como Vite, Webpack)

npm install highlightjs-clipboard-toastr @popperjs/core bootstrap bootstrap-icons highlight.js toastr
# Opcional:
npm install @fortawesome/fontawesome-free

✅ Opción 2: Usando archivos .min.js en HTML

Agrega los siguientes scripts y estilos directamente en tu HTML:

<!-- Bootstrap CSS y Bootstrap Icons -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" rel="stylesheet">

<!-- Toastr CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/build/toastr.min.css" rel="stylesheet">

<!-- FontAwesome (opcional) -->
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/fontawesome.min.css" rel="stylesheet">

<!-- highlight.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>

<!-- Toastr JS -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/toastr.min.js"></script>

<!-- highlightjs-clipboard-toastr -->
<script src="https://unpkg.com/highlightjs-clipboard-toastr/dist/js/hl-clip-toast.min.js"></script>

✨ Uso Básico

const coreInstance = new HCT({});
coreInstance.info();  // Muestra información útil de los parámetros disponibles
coreInstance.fire();  // Inicia el paquete

⚙️ Configuración Personalizada (Ejemplo)

const coreInstance = new HCT({
    iconDefault: 'fa-solid fa-clipboard',                       // Ícono por defecto
    iconSuccess: 'fa-solid fa-clipboard-check',                // Ícono al copiar exitosamente
    iconResetDelay: 2000,                                      // Tiempo para resetear ícono (ms)
    messageSuccess: '¡Copiado!',                               // Mensaje de éxito
    messageError: 'Ups, no se pudo copiar',                    // Mensaje de error
    messageClipboardUnsupported: 'Tu navegador no soporta copiar', // Si el navegador no soporta el portapapeles
    buttonClass: 'btn btn-sm btn-success position-absolute top-0 end-0 m-2', // Clase del botón
    wrapperClass: 'position-relative',                         // Clase del contenedor
    closeButton: true,                                         // Botón de cerrar en toastr
    progressBar: true,                                         // Barra de progreso en toastr
    timeOut: 3000,                                             // Duración de toastr (ms)
    validateClasses: true                                      // Validar clases del botón
});
coreInstance.fire(); // Iniciar

🧪 Consideraciones

Este paquete requiere que los bloques<pre><code> ya estén resaltados por highlight.js. Puedes usar tanto Bootstrap Icons como FontAwesome (según tu preferencia). Asegúrate de que todos los estilos estén correctamente cargados si usas archivos .min.js.

License

HighlightjsClipboardToastr is an open source project by HighlightjsClipboardToastr that is licensed under MIT. HighlightjsClipboardToastr reserves the right to change the license of future releases.