@creepyniki/markdown-copy-button
TypeScript icon, indicating that this package has built-in type declarations

1.0.58 • Public • Published

Markdown Copy Button Plugin

Functionality

This plugin adds a copy button to each code block in the markdown content. When the button is clicked, the content of the code block is copied to the clipboard.

Installation

Install markdown-it and markdown-it-copy-button via npm:

npm install markdown-it
npm install markdown-it-copy-button

Usage

import MarkdownIt from 'markdown-it';
import markdownCopyButton from 'markdown-copy-button';

const md = new MarkdownIt().use(markdownCopyButton, {
    // Options
});
const htmlContent = md.render('## markdown content');

Options

Option type Default Beschreibung
iconStyle String 'font-size: 20px; opacity: 0.4;' style of the copy icon
buttonStyle String 'position: absolute; top: 4.5px; right: 6px; cursor: pointer; outline: none;' style of the copy button
buttonClass String 'copyButton' class of the copy button
imageFolder String 'copy.svg' path to the icon for the copy button
imageWidth String '16px' width of the button element
imageHeight String '16px' height of the button element

Readme

Keywords

none

Package Sidebar

Install

npm i @creepyniki/markdown-copy-button

Weekly Downloads

290

Version

1.0.58

License

ISC

Unpacked Size

6.39 kB

Total Files

9

Last publish

Collaborators

  • creepyniki