Docusaurus: copy code button for Docusaurus 2

Created on 7 Jun 2019  路  4Comments  路  Source: facebook/docusaurus

馃殌 Feature

Have you read the Contributing Guidelines on issues?

yes

Motivation

Support copy codeblock button for Docusaurus 2

Where to start

Start docusaurus 2 website

  1. Clone this repository
  2. Read https://github.com/facebook/Docusaurus/tree/master/website and start website
  3. Go to any docs url with codeblock. maybe http://localhost:3000/docs/installation
    image

Modify here to test in Docusaurus 2 to add the copy code button
https://github.com/facebook/Docusaurus/blob/1aa0ea1152b0133830d127d11b123fcea261deb4/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/index.js#L33-L53

Also make sure to duplicate the change to https://github.com/facebook/Docusaurus/blob/master/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js

Send PR !!

good first issue help wanted v2

Most helpful comment

Hi there. I saw that hugofovargue closed his PR so I wanted to give it a go!

PR #1643

Feel free to close it if not applicable anymore I guess 馃槃

All 4 comments

Hi @endiliey I want to give it a try, and if you could guide me how we want to implement it like button or icon for copy that would be really helpful

@AlokTakshak feel free to propose a design. Best if we have 0 dependency for the icon

@endiliey Made a PR #1606. I tried to implement a similar style to the legacy copy button.

Hi there. I saw that hugofovargue closed his PR so I wanted to give it a go!

PR #1643

Feel free to close it if not applicable anymore I guess 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yangshun picture yangshun  路  70Comments

cameronelliott picture cameronelliott  路  28Comments

XavierNV picture XavierNV  路  24Comments

wgao19 picture wgao19  路  31Comments

knowbody picture knowbody  路  23Comments