diff --git a/packages/formatters/__tests__/formatters.test.ts b/packages/formatters/__tests__/formatters.test.ts index 645d9b817..32cb8b398 100644 --- a/packages/formatters/__tests__/formatters.test.ts +++ b/packages/formatters/__tests__/formatters.test.ts @@ -23,6 +23,7 @@ import { roleMention, spoiler, strikethrough, + subtext, time, TimestampStyles, underline, @@ -277,6 +278,12 @@ describe('Message formatters', () => { }); }); + describe('subtext', () => { + test('GIVEN "discord.js" THEN returns "-# discord.js"', () => { + expect<'-# discord.js'>(subtext('discord.js')).toEqual('-# discord.js'); + }); + }); + describe('time', () => { test('GIVEN no arguments THEN returns ""', () => { vitest.useFakeTimers(); diff --git a/packages/formatters/src/formatters.ts b/packages/formatters/src/formatters.ts index 37bfbaf9a..5ffa2a9e2 100644 --- a/packages/formatters/src/formatters.ts +++ b/packages/formatters/src/formatters.ts @@ -569,6 +569,16 @@ export function unorderedList(list: RecursiveArray): string { return listCallback(list); } +/** + * Formats the content into a subtext. + * + * @typeParam Content - This is inferred by the supplied content + * @param content - The content to wrap + */ +export function subtext(content: Content): `-# ${Content}` { + return `-# ${content}`; +} + /** * Formats a date into a short date-time string. *