Skip to content

✍️ Prompty:A tool library for writing prompt words in a more efficient and readable way.

License

Notifications You must be signed in to change notification settings

bijonai/promptal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Promptal

✍️ Promptal:A tool library for writing prompt words in a more efficient and readable way.

Installation

npm install promptal
pnpm add promptal
yarn add promptal
bun add promptal

Usage

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

APIs

Titles

API Description Markdown Result Preview
h1('Hello, world!') Creates a level 1 heading # Hello, world!

Hello, world!

h2('Subtitle') Creates a level 2 heading ## Subtitle

Subtitle

h3('Section') Creates a level 3 heading ### Section

Section

h4('Subsection') Creates a level 4 heading #### Subsection

Subsection

h5('Paragraph') Creates a level 5 heading ##### Paragraph
Paragraph
h6('Subparagraph') Creates a level 6 heading ###### Subparagraph
Subparagraph

Text Formatting

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++

Code

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")
```
console.log("hello")

Links and Media

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 ![Alt text](https://example.com/img.png) 🖼️ Image
footnote('1', ': Footnote text') Creates a footnote reference [^1]: Footnote text Footnote reference

Lists

API Description Markdown Result Preview
list('Item 1', 'Item 2') Creates an unordered list with "-" marker (default, type 1) - Item 1
- Item 2
  • Item 1
  • Item 2
list(1, 'Item 1', 'Item 2') Creates an unordered list with "-" marker (type 1) - Item 1
- Item 2
  • Item 1
  • Item 2
list(2, 'Item 1', 'Item 2') Creates an unordered list with "*" marker (type 2) * Item 1
* Item 2
  • Item 1
  • Item 2
list(3, 'Item 1', 'Item 2') Creates an unordered list with "+" marker (type 3) + Item 1
+ Item 2
  • 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
  • Parent
    • Child 1
    • Child 2

Document Structure

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

HTML Tags

API Description Markdown Result Preview
tag('div', 'content') Wraps content in custom HTML tags <div>content</div>
content

About

✍️ Prompty:A tool library for writing prompt words in a more efficient and readable way.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published