Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A docsify plugin that copies Markdown code block to your clipboard

License

Notifications You must be signed in to change notification settings

vicename/docsify-copy-code

Repository files navigation

docsify-copy-code

NPM License: MIT

A docsify plugin that adds a button to easily copy code blocks to your clipboard.

Installation

Production

Add following script tag to your index.html after docsify. Specifying the @[version] in the URL ensures that the release of a major update (v3.x) will not break your production site:

<!-- Latest v2.x.x -->
<script src="https://unpkg.com/docsify-copy-code@2"></script>

Development

If you prefer to load the latest version of the library, you may do so by omitting the @[version] from the above URL.

<!-- Latest (not recommended for production) -->
<script src="https://unpkg.com/docsify-copy-code"></script>

Options

Button text

Button text can be customized as follows:

window.$docsify = {
 // docsify-copy-code (defaults)
 copyCode: {
 buttonText : 'Copy to clipboard',
 errorText : 'Error',
 successText: 'Copied'
 }
}

Localization (l10n)

Button text can also be customized based on the current URL. Object key/value pairs are processed in the order provided.

window.$docsify = {
 copyCode: {
 buttonText: {
 '/zh-cn/': '点击复制',
 '/ru/' : 'Скопировать в буфер обмена',
 '/de-de/': 'Klicken Sie zum Kopieren',
 '/es/' : 'Haga clic para copiar',
 '/' : 'Copy to clipboard'
 },
 errorText: {
 '/zh-cn/': '错误',
 '/ru/' : 'ошибка',
 '/' : 'Error'
 },
 successText: {
 '/zh-cn/': '复制',
 '/ru/' : 'Скопировано',
 '/de-de/': 'Kopiert',
 '/es/' : 'Copiado',
 '/' : 'Copied'
 }
 }
}

Note: Docsify's alias option makes it easy to manage local content using separate directories. See the /demo/ content in this repo for an example.

License

This project is licensed under the MIT License. See the LICENSE for details.

About

A docsify plugin that copies Markdown code block to your clipboard

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.0%
  • CSS 9.0%

AltStyle によって変換されたページ (->オリジナル) /