From 267b2b1a0703313311da01addafcee28100347ea Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 12 Oct 2022 22:22:21 +0200 Subject: Commands: basic error handling --- src/utils/misc.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/utils') diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx index dfeb330..b646ec1 100644 --- a/src/utils/misc.tsx +++ b/src/utils/misc.tsx @@ -157,3 +157,11 @@ export function suppressErrors(name: string, func: F, thisOb } }) as any as F; } + +/** + * Wrap the text in ``` with an optional language + */ +export function makeCodeblock(text: string, language?: string) { + const chars = "```"; + return `${chars}${language || ""}\n${text}\n${chars}`; +} -- cgit