GitHubCopy is a simple TypeScript program that generates Markdown code. Combined with the free service GitHub Pages, you can integrate a Copy code button or link directly into your Markdown files. The button/link is completely customizable because it’s just a regular URL. No servers needed. No additional files needed. The only visible modification you need to add to your Markdown files is a little arrow. It would look like this:
class Animal extends Dog;
Copy code
More content…
Here would be a JS Script tag.
You can use the GitHubCopy generator in every JavaScript environment, either as a module or as a function as the TS source or as compiled JS. For more infos about the generator, read the JSDoc comments in the TS source code.
To integrate the code into your Markdown file, just paste the [result].markdown
at the end of your markdown file, and then you just have to link to your GitHub Page with the link provided by the script ([result].urls[x].url
).
Creating a GitHub Page is pretty easy:
See demo.md.
I might add a web interface soon. Currently you have to use a JS Console, but it can be ported for web because it’s written in TS.
Special thanks to my Insomnia. This project was created at 3am on a thursday because I couln’t sleep so I spent my time coding this while watching Tofu-chan (the only thing thats keeping me sâne pleaşέ śƎήĎ ђξҐſ)