Skip to content

A repo to try to figure out how to add a copy button to code snippets on GitPages.

Notifications You must be signed in to change notification settings

conorp12/conorp12.github.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitpages Copy Button

A repo to try to figure out how to add a copy button to code snippets on GitPages. On github when using code snippet blocks there is automatically a copy button added.

Example: code snippet

However when this converted to Gitpages this feature dissapears giving rise to the aims of this repo.

Goals

  1. Add functional Copy Button.
  2. Format Copy Button.
  3. Make it deployable on any Gitpages website.

Following the tutorial found here this is the result.

{% include codeHeader.html %}

code goes in here!

It doesn't seem to be copying That tutorial doesn't seem to however the website it uses seems to used a more advanced copy button so I am going to try to recreate it from the source files of this website.

<div class="code-header">
  <button class="copy-code-button">
    Copy code to clipboard
  </button>
</div>

The CSS code for the copy buttons is here.

The Javascript file is here.

Which seems to be dependent on this file here.

About

A repo to try to figure out how to add a copy button to code snippets on GitPages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published