opensearch-project / project-website

The source to opensearch.org
https://opensearch.org
BSD 3-Clause "New" or "Revised" License
39 stars 468 forks source link

Code blocks in our blog posts should have a "copy-button" #2901

Open kaimmej opened 1 month ago

kaimmej commented 1 month ago

Problem

A few of our blog posts - especially the ones regarding guides to using OpenSearch - display code segments. These are currently being rendered as just markdown code. They look like plain text and they do not have a button that allows users to copy the entire code segment to the clipboard. Honestly this is not much of an issue - most of the code segments are not large, but a few of the YAML configuration files are large enough that you need to scroll. I think this is slightly disruptive. A copy button is expected behavior.

I think they are specifically called "fenced blocks" and are represented in markdown with the triple-tick (```) Syntax highlighting is also an easy feature to implement. Read more here: github doc for fenced blocks

Current State

image

Example of future state

image

Solution

A clear and concise description of what you want to happen.

Alternatives

We are currently using the markdown syntax and formatting. So I believe we are locked into this, there are a couple of ways that we might be able to do this. I do not know enough to be able to present a comprehensive list of alternatives. Likley the solution here is to update each markdown file in _posts to be representative of the code-language within the code block. I do not know of a dynamic solution that could auto-update all of them.

dblock commented 2 weeks ago

Catch All Triage - 1 2 3 4 5 6