{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Make the text bold.\n * @param text - The input text.\n * @returns The input text wrapped in double asterisks.\n */\nexport const bold = (text: string) => `**${text}**`;\n\n/**\n * Make the text italic.\n * @param text - The input text.\n * @returns The input text wrapped in underscores.\n */\nexport const italic = (text: string) => `_${text}_`;\n\n/**\n * Add strike-through to the text.\n * @param text - The input text.\n * @returns The input text wrapped in double tildes.\n */\nexport const del = (text: string) => `~~${text}~~`;\n\n/**\n * Add underline to the text.\n * @param text - The input text.\n * @returns The input text wrapped in tags.\n */\nexport const underline = (text: string) => `${text}`;\n\n/**\n * Create an anchor link.\n * @param text - The anchor text.\n * @param href - The URL to link to.\n * @returns An anchor link in markdown format.\n */\nexport const anchor = (text: string, href: string) => `[${text}](${href})`;\n\n/**\n * Create a code block or inline code.\n * @param inline - Whether the code should be inline or in a block.\n * @param language - The code language for syntax highlighting.\n * @param text - The code content.\n * @returns A code block or inline code in markdown format.\n */\nexport const code =\n (inline = false) =>\n (language = \"\") =>\n (text: string) => {\n const signature = inline ? \"`\" : \"```\";\n const lang = inline ? \"\" : language;\n const delimiter = inline ? \"\" : \"\\n\";\n return [signature + lang, text, signature].join(delimiter);\n };\n\n/**\n * Create inline code with optional syntax highlighting.\n * @param text - The code content.\n * @returns Inline code in markdown format.\n */\nexport const inlineCode = code(true)();\n\n/**\n * Create a code block with optional syntax highlighting.\n * @param language - The code language for syntax highlighting (optional).\n * @param text - The code content.\n * @returns A code block in markdown format.\n */\nexport const codeBlock = code();\n\n/**\n * Create an equation block or inline equation.\n * @param inline - Whether the equation should be inline or in a block.\n * @param text - The equation content.\n * @returns An equation block or inline equation in markdown format.\n */\nexport const equation =\n (inline = false) =>\n (text: string) => {\n const signature = inline ? \"$\" : \"$$\";\n const delimiter = inline ? \"\" : \"\\n\";\n return [signature, text, signature].join(delimiter);\n };\n\n/**\n * Create an inline equation in markdown format.\n * @param text - The equation content.\n * @returns An inline equation enclosed in '$' delimiters.\n */\nexport const inlineEquation = equation(true);\n\n/**\n * Create an equation block in markdown format.\n * @param text - The equation content.\n * @returns An equation block enclosed in '$$' delimiters.\n */\nexport const equationBlock = equation();\n\n/**\n * Create a heading with the specified level.\n * @param level - The level of the heading (1 to 6).\n * @param text - The heading text.\n * @returns A heading in markdown format.\n */\nexport const h =\n (level = 1) =>\n (text: string) =>\n `${\"#\".repeat(level)} ${text}`;\n\n/**\n * Create a level 1 heading.\n */\nexport const h1 = h();\n\n/**\n * Create a level 2 heading.\n */\nexport const h2 = h(2);\n\n/**\n * Create a level 3 heading.\n */\nexport const h3 = h(3);\n\n/**\n * Create a level 4 heading.\n */\nexport const h4 = h(4);\n\n/**\n * Create a level 5 heading.\n */\nexport const h5 = h(5);\n\n/**\n * Create a level 6 heading.\n */\nexport const h6 = h(6);\n\n/**\n * Alias for creating headings.\n */\nexport const heading = h;\n\n/**\n * Convert text to a blockquote.\n * @param text - The input text.\n * @returns The input text indented and prefixed with \">\".\n */\nexport const quote = (text: string) =>\n text\n .split(\"\\n\")\n .map((line) => `> ${line}`)\n .join(\"\\n\");\n\n/**\n * Create a bullet point list item.\n * @param text - The content of the bullet point.\n * @param count - The optional index/count of the bullet point.\n * @returns A bullet point item in markdown format.\n */\nexport const bullet = (text: string, count?: number) =>\n count ? `${count}. ${text}` : `- ${text}`;\n\n/**\n * Create a todo list item.\n * @param text - The content of the todo item.\n * @param checked - Whether the todo item is checked or not.\n * @returns A todo list item in markdown format.\n */\nexport const todo = (text: string, checked: boolean) =>\n checked ? `- [x] ${text}` : `- [ ] ${text}`;\n\n/**\n * Create an image element.\n * @param alt - The alt text for the image.\n * @param href - The URL of the image.\n * @returns An image element in markdown format.\n */\nexport const image = (alt: string, href: string) =>\n href.startsWith(\"data:\")\n ? `![${alt}](data:image/png;base64,${href.split(\",\").pop()})`\n : `![${alt}](${href})`;\n\n/**\n * Create a horizontal divider.\n * @returns A horizontal divider in markdown format.\n */\nexport const hr = () => `---`;\n\n/**\n * Create a collapsible details element.\n * @param summary - The summary text for the details element.\n * @param details - The details/content of the details element.\n * @returns A details element in markdown format.\n */\nexport const details = (summary: string, details: string) => `
\n${summary}\n\n${details}\n
`;\n\n/**\n * Create a superscript text.\n * @param text - The input text.\n * @returns The input text wrapped in tags.\n */\nexport const sup = (text: string) => `${text}`;\n\n/**\n * Create a subscript text.\n * @param text - The input text.\n * @returns The input text wrapped in tags.\n */\nexport const sub = (text: string) => `${text}`;\n\n/**\n * Indent the text with a specified number of spaces.\n * @param space - The number of spaces to indent with.\n * @param text - The input text.\n * @param level - The level of indentation.\n * @returns The input text with added indentation.\n */\nexport const indent =\n (space = 2) =>\n (text: string, level = 1) => {\n const tab = \" \".repeat(space);\n\n return text\n .split(\"\\n\")\n .map((line) => tab.repeat(level) + line)\n .join(\"\\n\");\n };\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,SAAAC,EAAA,WAAAC,EAAA,SAAAC,EAAA,cAAAC,EAAA,QAAAC,EAAA,YAAAC,EAAA,aAAAC,EAAA,kBAAAC,EAAA,MAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,YAAAC,EAAA,OAAAC,EAAA,UAAAC,EAAA,WAAAC,EAAA,eAAAC,EAAA,mBAAAC,EAAA,WAAAC,EAAA,UAAAC,EAAA,QAAAC,EAAA,QAAAC,EAAA,SAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAA9B,GAKO,IAAMG,EAAQ4B,GAAiB,KAAKA,CAAI,KAOlCP,EAAUO,GAAiB,IAAIA,CAAI,IAOnCxB,EAAOwB,GAAiB,KAAKA,CAAI,KAOjCF,EAAaE,GAAiB,MAAMA,CAAI,OAQxC7B,EAAS,CAAC6B,EAAcC,IAAiB,IAAID,CAAI,KAAKC,CAAI,IAS1D3B,EACX,CAAC4B,EAAS,KACV,CAACC,EAAW,KACXH,GAAiB,CAChB,IAAMI,EAAYF,EAAS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A,CAAI,SAOpCL,EAAOK,GAAiB,QAAQA,CAAI,SASpCV,EACX,CAACuB,EAAQ,IACT,CAACb,EAAcO,EAAQ,IAAM,CAC3B,IAAMO,EAAM,IAAI,OAAOD,CAAK,EAE5B,OAAOb,EACJ,MAAM;AAAA,CAAI,EACV,IAAKQ,GAASM,EAAI,OAAOP,CAAK,EAAIC,CAAI,EACtC,KAAK;AAAA,CAAI,CACd","names":["src_exports","__export","anchor","bold","bullet","code","codeBlock","del","details","equation","equationBlock","h","h1","h2","h3","h4","h5","h6","heading","hr","image","indent","inlineCode","inlineEquation","italic","quote","sub","sup","todo","underline","__toCommonJS","text","href","inline","language","signature","lang","delimiter","level","line","count","checked","alt","summary","space","tab"]}