1. vuepress-plugin-code-copy
A Vuepress plugin that adds copy code buttons to all code blocks.
vuepress-plugin-code-copy
Package: vuepress-plugin-code-copy
Created by: znicholasbrown
Last modified: Mon, 23 May 2022 22:07:05 GMT
Version: 1.0.6
License: GPL-3.0-or-later
Downloads: 6,924
Repository: https://github.com/znicholasbrown/vuepress-plugin-code-copy

Install

npm install vuepress-plugin-code-copy
yarn add vuepress-plugin-code-copy

Vuepress Code Copy Plugin

A plugin for Vuepress that appends a copy button to every instance of a given selector (defaults to div[class*="language-"] pre)

Installation

$ npm install vuepress-plugin-code-copy
# OR
$ yarn add vuepress-plugin-code-copy

Usage

The plugin can be added to .vuepress/config.js in your Vuepress project under plugins:

 module.exports = {
    plugins: [['vuepress-plugin-code-copy', true]]
}

Options

The plugin takes a number of options, which can be passed in with the plugin config in an options object:

module.exports = {
  plugins: [
    ["vuepress-plugin-code-copy", {
        selector: String,
        align: String,
        color: String,
        backgroundTransition: Boolean,
        backgroundColor: String,
        successText: String
        }
    ]
  ]
}

selector

  • Type: String
  • Default: div[class*="language-"] pre

This is the CSS selector to which the copy button component will be attached.

align

  • Type: String
  • Default: bottom
  • Supported options: top and bottom

This option describes the vertical position of the copy button component as well as the successText

color

  • Type: String
  • Default: #27b1ff

This sets the color of the copy button and can take any hex code.

backgroundTransition

  • Type: Boolean
  • Default: true

Enables the background transition animation of the attached code block when a user presses the copy button.

backgroundColor

  • Type: String
  • Default: #0075b8

This sets the color of the background transition animation and can take any hex code.

successText

  • Type: String
  • Default: Copied!

This sets the text that displays when a user presses the copy button.

staticIcon

  • Type: Boolean
  • Default: false

Copy icon is only visible when hovering over code block or is always visible.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code