Add copy for code snippets in markdown

Use case or problem

On a published website, given a code snippet (marked as a language, ex, java, shell, …), add a button to let a user easily copy the snippet.

This would make knowledge bases that have a bunch of shell commands especially easy to use. As well as make code snippets easier in general to get out of the knowledge base.

Proposed solution

On code snippets add a copy button similar to what the microsoft docs have
ex: Tutorial: Read a secret from Azure Key Vault in a Spring Boot application | Microsoft Docs → scroll down to commands, they have a convenient copy button.

This could be invisible and appear on hover to not pollute the pages too much.

Current workaround (optional)

Select the text manually and copy manually.

Related feature requests (optional)

1 Like