@promptbook/markdown-utils 0.101.0-2 โ 0.101.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -48,7 +48,93 @@ npm i ptbk
|
|
|
48
48
|
npm install @promptbook/markdown-utils
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Comprehensive markdown processing utilities for the Promptbook ecosystem, providing tools for parsing, manipulating, and extracting content from markdown documents.
|
|
52
|
+
|
|
53
|
+
## ๐ฏ Purpose and Motivation
|
|
54
|
+
|
|
55
|
+
This package provides specialized markdown processing capabilities that are essential for working with promptbooks and LLM-generated content. It handles markdown parsing, content extraction, text humanization, and various markdown transformations that are commonly needed when processing AI-generated text and promptbook documentation.
|
|
56
|
+
|
|
57
|
+
## ๐ง High-Level Functionality
|
|
58
|
+
|
|
59
|
+
The package offers comprehensive markdown processing capabilities:
|
|
60
|
+
|
|
61
|
+
- **Content Extraction**: Extract code blocks, lists, and sections from markdown
|
|
62
|
+
- **Text Processing**: Parse and manipulate markdown sections and content
|
|
63
|
+
- **AI Text Humanization**: Transform AI-generated text to be more human-readable
|
|
64
|
+
- **Markdown Manipulation**: Add, remove, and modify markdown formatting
|
|
65
|
+
- **Table and Chart Creation**: Generate markdown tables and charts
|
|
66
|
+
- **Scraping Integration**: Markdown-specific content scraping capabilities
|
|
67
|
+
|
|
68
|
+
## โจ Key Features
|
|
69
|
+
|
|
70
|
+
- ๐ **Content Extraction** - Extract blocks, lists, and sections from markdown documents
|
|
71
|
+
- ๐จ **Text Humanization** - Transform AI text with proper quotes, ellipsis, and formatting
|
|
72
|
+
- ๐ง **Markdown Manipulation** - Add, remove, and modify markdown formatting
|
|
73
|
+
- ๐ **Table Generation** - Create formatted markdown tables and charts
|
|
74
|
+
- ๐งน **Content Cleaning** - Remove comments, links, and unwanted formatting
|
|
75
|
+
- ๐ **Section Parsing** - Parse and split markdown into structured sections
|
|
76
|
+
- ๐ **Block Processing** - Extract and process code blocks and content blocks
|
|
77
|
+
- ๐ค **AI Integration** - Specialized tools for processing LLM-generated markdown
|
|
78
|
+
|
|
79
|
+
## ๐ฆ Exported Entities
|
|
80
|
+
|
|
81
|
+
### Version Information
|
|
82
|
+
|
|
83
|
+
- `BOOK_LANGUAGE_VERSION` - Current book language version
|
|
84
|
+
- `PROMPTBOOK_ENGINE_VERSION` - Current engine version
|
|
85
|
+
|
|
86
|
+
### Content Extraction
|
|
87
|
+
|
|
88
|
+
- `extractBlock` - Extract specific blocks from content
|
|
89
|
+
- `extractJsonBlock` - Extract JSON blocks from content
|
|
90
|
+
- `extractAllBlocksFromMarkdown` - Extract all code blocks from markdown
|
|
91
|
+
- `extractAllListItemsFromMarkdown` - Extract all list items from markdown
|
|
92
|
+
- `extractOneBlockFromMarkdown` - Extract single code block from markdown
|
|
93
|
+
|
|
94
|
+
### Markdown Scraping
|
|
95
|
+
|
|
96
|
+
- `createMarkdownScraper` - Create markdown content scraper
|
|
97
|
+
- `MarkdownScraper` - Markdown scraper class
|
|
98
|
+
- `_MarkdownScraperRegistration` - Markdown scraper registration
|
|
99
|
+
|
|
100
|
+
### Type Definitions
|
|
101
|
+
|
|
102
|
+
- `string_markdown` - Markdown string type (type)
|
|
103
|
+
- `string_markdown_section` - Markdown section string type (type)
|
|
104
|
+
- `string_markdown_section_content` - Markdown section content type (type)
|
|
105
|
+
- `string_markdown_text` - Markdown text string type (type)
|
|
106
|
+
- `string_markdown_codeblock_language` - Markdown code block language type (type)
|
|
107
|
+
- `MarkdownSection` - Markdown section structure (type)
|
|
108
|
+
|
|
109
|
+
### Content Generation
|
|
110
|
+
|
|
111
|
+
- `addAutoGeneratedSection` - Add auto-generated sections to markdown
|
|
112
|
+
- `createMarkdownChart` - Create markdown charts and diagrams
|
|
113
|
+
- `createMarkdownTable` - Create formatted markdown tables
|
|
114
|
+
|
|
115
|
+
### Text Processing
|
|
116
|
+
|
|
117
|
+
- `escapeMarkdownBlock` - Escape markdown block content
|
|
118
|
+
- `flattenMarkdown` - Flatten markdown structure
|
|
119
|
+
- `parseMarkdownSection` - Parse markdown into sections
|
|
120
|
+
- `splitMarkdownIntoSections` - Split markdown into structured sections
|
|
121
|
+
|
|
122
|
+
### AI Text Humanization
|
|
123
|
+
|
|
124
|
+
- `humanizeAiText` - Comprehensive AI text humanization
|
|
125
|
+
- `humanizeAiTextEllipsis` - Fix ellipsis formatting in AI text
|
|
126
|
+
- `humanizeAiTextEmdashed` - Fix em-dash formatting in AI text
|
|
127
|
+
- `humanizeAiTextQuotes` - Fix quote formatting in AI text
|
|
128
|
+
- `humanizeAiTextWhitespace` - Fix whitespace in AI text
|
|
129
|
+
- `promptbookifyAiText` - Transform AI text for promptbook format
|
|
130
|
+
|
|
131
|
+
### Content Cleaning
|
|
132
|
+
|
|
133
|
+
- `removeMarkdownComments` - Remove comments from markdown
|
|
134
|
+
- `removeMarkdownFormatting` - Remove markdown formatting
|
|
135
|
+
- `removeMarkdownLinks` - Remove links from markdown
|
|
136
|
+
|
|
137
|
+
> ๐ก This package provides markdown processing utilities for promptbook applications. For the core functionality, see [@promptbook/core](#-packages) or install all packages with `npm i ptbk`
|
|
52
138
|
|
|
53
139
|
|
|
54
140
|
---
|
package/esm/index.es.js
CHANGED
|
@@ -23,7 +23,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-3';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -119,4 +119,24 @@ export type ChatProps = {
|
|
|
119
119
|
* Keys should match ChatMessage.from values (e.g., 'USER', 'AGENT_{id}', etc.)
|
|
120
120
|
*/
|
|
121
121
|
readonly participants?: ReadonlyArray<ChatParticipant>;
|
|
122
|
+
/**
|
|
123
|
+
* Optional callback for handling user feedback on messages
|
|
124
|
+
* When provided, star rating buttons (1-5 stars) will be displayed next to each message
|
|
125
|
+
*
|
|
126
|
+
* @param feedback - Object containing the feedback data
|
|
127
|
+
* @param feedback.message - The message being rated
|
|
128
|
+
* @param feedback.rating - Star rating from 1 to 5
|
|
129
|
+
* @param feedback.textRating - Optional text feedback/note from user
|
|
130
|
+
* @param feedback.chatThread - Complete chat thread as string
|
|
131
|
+
* @param feedback.expectedAnswer - Optional expected answer provided by user
|
|
132
|
+
* @param feedback.url - Current page URL where feedback was given
|
|
133
|
+
*/
|
|
134
|
+
onFeedback?(feedback: {
|
|
135
|
+
message: ChatMessage;
|
|
136
|
+
rating: number;
|
|
137
|
+
textRating: string;
|
|
138
|
+
chatThread: string;
|
|
139
|
+
expectedAnswer: string | null;
|
|
140
|
+
url: string;
|
|
141
|
+
}): Promisable<void>;
|
|
122
142
|
};
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.101.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.101.0-2`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-3';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|