The Copy Button
Made on 2023-03-06
Today, I added the ability to copy the text content of a CodeBlock.
Useful for commands
This is useful for blocks of commands that need to be run as part of a tutorial (though sometimes, a one-liner that chains commands with the ol' && is more appropriate).
git clone https://github.com/example/test
cd test
yarn
yarn start
Useful for sharing code otherwise
This is also clearly useful to make code easily accessible if you expect a reader to want to use it directly.
import type { Problem } from "@the-world";
import { getDefaultContext, getLogger } from "$core";
export function universalSolution(problem: Problem): NodeJS.Timeout {
return setTimeout(() => {
const logger = getLogger();
const context = getDefaultContext();
logger.info({ context, message: "42" });
}, 75 * 1000000 * 365.242199 * 24 * 60 * 60 * 1000);
}