Problem Statement:
I want to create a website with beginner friendly guides of how to do some basic bash and Kubernetes automation. (Beginner friendly as in Explanations + copy paste-able code snippets).
I currently use logic like this, when I write how to guides:
set +o history #turn off shell history
export REGISTRY_USERNAME=<REPLACE_ME>
export REGISTRY_PASSWORD=<REPLACE_ME>
echo $REGISTRY_PASSWORD | docker login myregistry.local --username $REGISTRY_USERNAME --password-stdin
set -o history #turn on shell history
The problem with this approach is it falls victim to the universal truth of “Humans don’t read they skim,” and when I watch users follow my how to guides I find the approach is surprising prone to human error, especially to new users that are sometimes new to even terminal basics, and don’t realize things like KEY=VALUE without spaces is important.
Desired State:
One day I discovered this page and was like OMG that’s an amazing User Experience! https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#verify_the_setup
In case the webpage changes in the future this is what it looks like:

This functionality is such a good user experience!
- It’s dead obvious that a user can edit that variable. (friendly to humans who skim instead of read)
- When you edit it on one spot on the page, it updates it in multiple locations on the page.
- You can even switch
kubectl to yaml and it generates a yaml via KISS string variable substitution.
- Best part is the copy paste-able command loads the copy paste-able hard coded values, which is extremely user friendly, because it’s mistake proof. (with my method best case scenario someone copy pastes into a document, edits it, then re-copy/pastes into terminal.)
I want to reproduce this functionality so I can make mistake proof how to guides.
Constraints by which I wish to achieve desired state:
I’ve been able to successfully use Docusarus, a static site generator, to make a secure website that I can host for free using serverless hosting solutions like Cloudflare’s pages.dev or a CDN. Currently I’m planning to generate the majority of webpages from markdown files, like how_to_x.md. The thing is Docusarus supports MDX, an it’s possible to create a file called how_to_x.mdx, my understanding is I can write in 95% markdown, and then mix a minimum amount of JavaScript, and it’ll convert it to JSX, which is some kind of javascript standard, which should make it plausible for me to implement functionality similar to what exists on google cloud’s docs.
Note: I’ve done basic Java, Python, and Bash programming before. I’ve also been able to use npm to install Docusaurus plugins. But Javascript and frontend development is a different beast, and I’d rather not learn it, because it’s a rabbit hole, and I don’t want that rabbit hole to distract me from continuing to explore the depths of the rabbit hole that is Kubernetes and push button end to end automated infrastructure as code. So I’m looking for someone whose familiar with the Javascript ecosystem to point me in the direction of a KISS solution that works with a static hosting solution.
Things I’ve looked into so far:
- I’ve read all of Docusaurus’ docs and saw that rehype and remark MDX plugins exist, but none of them looked that useful.
- I’ve tried to view the page source of the google doc, but couldn’t figure out how the magic was working.
- I don’t think google’s documentation website’s source code is public like Rancher’s is, I found this page while trying o see if something existed https://developers.google.com/style/placeholders, but it seems to be specific to contributors of their website and I suspect their website has some magic sauce that makes this work because when I copy paste the examples into HTML Javascript playground / fast feedback loop websites like these:
It doesn’t work the same.
Note: When answering if possible, I would appreciate if someone could give a KISS short self contained example that works using a playground site like jsfiddle. Pointers in the right direction of libraries that can make this easy and work within constraints would also be welcome (Javascript is a stupidly large ecosystem.)