webforai 1.1.3 → 1.1.4

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.
Files changed (2) hide show
  1. package/README.md +74 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Web for AI
2
+
3
+ ![LOGO](https://github.com/inaridiy/webforai/blob/main/images/logo.webp)
4
+
5
+ A library that provides a web interface for AI
6
+
7
+ ## Features
8
+
9
+ - Ultra-precise HTML2Markdown conversion
10
+ - Ultra-precise Markdown segmentation based on AST
11
+ - Ultra-precise HTML retrieval functions using headless browsers
12
+ - The core functionality is edge-native (runs on Cloudflare Workers!!!)
13
+
14
+ ## Demo
15
+
16
+ There is a demo API for Html2Markdown deployed on CloudflareWorker. Please access the following link
17
+
18
+ - [https://webforai.inaridiy.workers.dev/?url=https://www.npmjs.com/package/webforai](https://webforai.inaridiy.workers.dev/?url=https://www.npmjs.com/package/webforai)
19
+ - [https://webforai.inaridiy.workers.dev/?html=%3Ch1%3EHello%20World%3C/h1%3E](https://webforai.inaridiy.workers.dev/?html=%3Ch1%3EHello%20World%3C/h1%3E)
20
+
21
+ ## Quick Start
22
+
23
+ Just install and execute scripts
24
+
25
+ ```bash
26
+ pnpm i webforai playwright
27
+ ```
28
+
29
+ ```js
30
+ import { promises as fs } from "fs";
31
+ import { htmlToMarkdown, htmlToMdast } from "webforai";
32
+ import { loadHtml } from "webforai/loaders/playwright";
33
+
34
+ const url = "https://www.npmjs.com/package/webforai";
35
+ const html = await loadHtml(url);
36
+
37
+ const markdown = htmlToMarkdown(html, { solveLinks: url });
38
+
39
+ await fs.writeFile("output.md", markdown);
40
+ ```
41
+
42
+ other examples are in [examples](./examples/simple/src/index.ts)
43
+
44
+ ## Usage
45
+
46
+ ### Main Functions
47
+
48
+ **`htmlToMarkdown(html: string, options?: HtmlToMarkdownOptions): string`**
49
+ Convert HTML to Markdown. By default, unnecessary HTML is excluded and processed.
50
+ If `solveLinks` is specified, the relative links in the Mdast will be resolved.
51
+ This function just calls htmlToMdast and mdastToMarkdown in that order internally.
52
+
53
+ **`htmlToMdast(html: string, options?: HtmlToMdastOptions): Mdast`**
54
+ This project uses Hast and Mdast as defined by syntax-tree internally.
55
+ This function converts HTML to Mdast, an intermediate representation, which is required when using `mdastSplitter`, etc.
56
+
57
+ **`mdastToMarkdown(mdast: Mdast | RootContent[], options?: { solveLinks?: string }): string`**
58
+ Convert Mdast to Markdown. If `solveLinks` is specified, the relative links in the Mdast will be resolved.
59
+
60
+ ### Loader Functions
61
+
62
+ **`loadHtml(url: string, options?: LoadHtmlOptions): Promise<string>`**
63
+ Load HTML from the specified URL. This function uses Playwright internally.
64
+
65
+ ## Early Users
66
+
67
+ ### Voice Genius - Explanatory video generation by AI
68
+
69
+ <img src="https://github.com/inaridiy/webforai/blob/main/images/voice-genius.png" width="300px">
70
+
71
+ by [@moons14](https://twitter.com/moons_dev)
72
+
73
+ AI can be used to automatically generate highly accurate commentary videos.
74
+ Supports conversations and presentations using synthesized voice, embedding of images in videos, etc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webforai",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "A library that provides a web interface for AI",
5
5
  "author": "inaridiy",
6
6
  "license": "MIT",