New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

highlightjs-copy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highlightjs-copy

A simple, accessible highlightjs plugin to add a copy button to your codeblocks.

  • 1.0.1
  • npm
  • Socket score

Version published
Weekly downloads
525
decreased by-85.08%
Maintainers
1
Weekly downloads
 
Created
Source

highlightjs-copy

A simple, accessible highlightjs plugin to add a copy button to your codeblocks.

Install

Using a CDN

<script src="https://unpkg.com/highlightjs-copy/dist/highlightjs-copy.min.js"></script>
<link
  rel="stylesheet"
  href="https://unpkg.com/highlightjs-copy/dist/highlightjs-copy.min.css"
/>

NPM

npm install highlightjs-copy

Usage

Basic usage

hljs.addPlugin(CopyButtonPlugin());

With a callback

hljs.addPlugin(
  CopyButtonPlugin(function (el, text) {
    console.log("Copied to clipboard", text);
  })
);

Customization

CSS selectorDetails
.hljs-copy-wrapperApplied to the parent <pre> element that wraps the .hljs code.
.hljs-copy-buttonThe copy button itself.
[data-copied='true']This data attribute is applied to the copy button and is set to true for two seconds when the copy action is performed.
.hljs-copy-alertA visually hidden status element that announces the copy confirmation to screen readers.

FAQs

Package last updated on 13 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc