Skip to content

Instantly share code, notes, and snippets.

View sultanki's full-sized avatar
🐝

Kimberly S sultanki

🐝
View GitHub Profile
@sultanki
sultanki / docusaurus-copy-button.md
Created September 16, 2020 22:32 — forked from yangshun/docusaurus-copy-button.md
How to add the "Copy" button to code blocks in Docusaurus

Adding "Copy" (to Clipboard) Button

If you would like to add a button to your fenced code blocks so that users may copy the code, you can do so in Docusaurus. You will have to add some code to your Docusaurus project, as seen below.

Under static/js, create a file called code-block-buttons.js with the following:

// Turn off ESLint for this file because it's sent down to users as-is.
/* eslint-disable */
window.addEventListener('load', function() {