✍️ Promptal:A tool library for writing prompt words in a more efficient and readable way.
npm install promptal
pnpm add promptal
yarn add promptal
bun add promptal
import * as p from 'promptal'
const doc = p.document(
p.h1(
'Hello, world!',
p.g('This', 'is', 'Mike')
),
p.list(
'Good 1',
list(2,
'This good is pretty good',
'This good is not so good'
),
'Good 2',
list(2,
'This good is bad',
'This good is ugly'
)
)
)
console.log(doc())
Preview
# Hello, world!
This is Mike
- Good 1
- This good is pretty good
- This good is not so good
Good 2
- This good is bad
This good is ugly
| API |
Description |
Markdown Result |
Preview |
| h1('Hello, world!') |
Creates a level 1 heading |
# Hello, world! |
|
| h2('Subtitle') |
Creates a level 2 heading |
## Subtitle |
|
| h3('Section') |
Creates a level 3 heading |
### Section |
|
| h4('Subsection') |
Creates a level 4 heading |
#### Subsection |
|
| h5('Paragraph') |
Creates a level 5 heading |
##### Paragraph |
|
| h6('Subparagraph') |
Creates a level 6 heading |
###### Subparagraph |
|
| API |
Description |
Markdown Result |
Preview |
| b('Bold text') |
Makes text bold |
**Bold text** |
Bold text |
| i('Italic text') |
Makes text italic |
*Italic text* |
Italic text |
| s('Strikethrough') |
Adds strikethrough formatting |
~~Strikethrough~~ |
Strikethrough |
| u('Underline') |
Underlines text |
__Underline__ |
Underline |
| del('Deleted') |
Marks text as deleted |
~~Deleted~~ |
Deleted |
| ins('Inserted') |
Marks text as inserted |
++Inserted++ |
Inserted |
| API |
Description |
Markdown Result |
Preview |
| code('inline code') |
Creates inline code formatting |
`inline code` |
inline code |
| codeblock('js', 'console.log("hello")') |
Creates a code block with language syntax highlighting |
```js console.log("hello") ``` |
|
| API |
Description |
Markdown Result |
Preview |
| link('https://example.com', 'Example') |
Creates a hyperlink with text and URL |
[Example](https://example.com) |
Example |
| image('https://example.com/img.png', 'Alt text') |
Embeds an image with alt text |
 |
🖼️ Image |
| footnote('1', ': Footnote text') |
Creates a footnote reference |
[^1]: Footnote text |
Footnote reference |
| API |
Description |
Markdown Result |
Preview |
| list('Item 1', 'Item 2') |
Creates an unordered list with "-" marker (default, type 1) |
- Item 1 - Item 2 |
|
| list(1, 'Item 1', 'Item 2') |
Creates an unordered list with "-" marker (type 1) |
- Item 1 - Item 2 |
|
| list(2, 'Item 1', 'Item 2') |
Creates an unordered list with "*" marker (type 2) |
* Item 1 * Item 2 |
|
| list(3, 'Item 1', 'Item 2') |
Creates an unordered list with "+" marker (type 3) |
+ Item 1 + Item 2 |
|
| list('Parent', list('Child 1', 'Child 2')) |
Creates nested lists - child lists are automatically indented with 2 spaces |
- Parent - Child 1 - Child 2 |
|
| API |
Description |
Markdown Result |
Preview |
| sections('Part 1', 'Part 2') |
Joins content with double newlines (paragraph separator) |
Part 1
Part 2 |
Part 1
Part 2 |
| g('word1', 'word2') |
Joins content with spaces (group) |
word1 word2 |
word1 word2 |
| nl('line1', 'line2') |
Joins content with single newlines |
line1 line2 |
line1 line2 |
| tab('nested', 'content') |
Indents content with 2 spaces |
nested content |
nested content |
| API |
Description |
Markdown Result |
Preview |
| tag('div', 'content') |
Wraps content in custom HTML tags |
<div>content</div> |
content |