boostorg / website-v2-docs

Boost Site Documentation
https://docs.cppalliance.org
Boost Software License 1.0
6 stars 20 forks source link

Copy buttons for code snippets #24

Open anarthal opened 1 year ago

anarthal commented 1 year ago

Most other software provides a copy button for tutorials. Example (gcloud): https://cloud.google.com/compute/docs/instances/create-start-instance#python

While there isn't a built-in feature in asciidoc, it looks like it may be possible with some JS: https://github.com/asciidoctor/asciidoctor-extensions-lab/issues/61

anarthal commented 1 year ago

Well apparently they are there and I didn't see them at first glance. Could we make them more obvious?

vinniefalco commented 1 year ago

I think its fine the way it is. You have to pay the cost of learning that it is there. But once you pay that cost, then you enjoy it forever at no charge. Now compare that with Google's documentation:

image

The controls for copy and dark mode are there, which means that there is no cost to learning the feature exists and how to use it. But now, you have these two ugly controls in your face for eternity where they are no longer doing any good.

So I look at it this way: one UI has a small fixed cost, while the other UI has an infinite cost.

vinniefalco commented 1 year ago

That said, we can probably do something to give the controls more contrast on hover