@sapphire/utilities
Version:
Common JavaScript utilities for the Sapphire Community
28 lines (26 loc) • 1.31 kB
text/typescript
/**
* Wraps the content inside a codeblock with no language
*
* @remark If the provided content includes 3 backticks (```) then those backticks will be escaped
* by adding a [Zero Width Space](https://en.wikipedia.org/wiki/Zero-width_space) between the first and second backtick
*
* @remark If the provided content ends with a backtick then a [Zero Width Space](https://en.wikipedia.org/wiki/Zero-width_space) will be added
* to the end of the content
*
* @param content - The content to wrap
*/
declare function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\n\`\`\``;
/**
* Wraps the content inside a codeblock with the specified language
*
* @remark If the provided content includes 3 backticks (```) then those backticks will be escaped
* by adding a [Zero Width Space](https://en.wikipedia.org/wiki/Zero-width_space) between the first and second backtick
*
* @remark If the provided content ends with a backtick then a [Zero Width Space](https://en.wikipedia.org/wiki/Zero-width_space) will be added
* to the end of the content
*
* @param language The codeblock language
* @param content The expression to be wrapped in the codeblock
*/
declare function codeBlock<L extends string, C extends string>(language: L, content: C): `\`\`\`${L}\n${C}\n\`\`\``;
export { codeBlock };