UNPKG
@yankeeinlondon/promptly
Version:
latest (0.1.0)
0.1.0
An automation tool for prompting your favorite LLMs
@yankeeinlondon/promptly
/
src
/
utils
/
codeBlock.ts
14 lines
(10 loc)
•
265 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
{ stripLeading }
from
"inferred-types"
;
import
{ basename, extname }
from
"pathe"
;
export
function
codeBlock
(
text
:
string
,
filename
:
string
) {
return
` #####
${basename(filename)}
\`\`\`
${stripLeading(extname(filename),
"."
)}
${text.trim()}
\`\`\` `
; }