Giter Club home page Giter Club logo

vuepress-plugin-code-copy's Introduction

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.

vuepress-plugin-code-copy's People

Contributors

arvola avatar znicholasbrown avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.