defuddle-cli 0.1.0
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/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1041 -0
- package/dist/markdown.d.ts +1 -0
- package/dist/markdown.js +511 -0
- package/package.json +34 -0
- package/src/index.ts +1163 -0
- package/src/markdown.ts +603 -0
- package/tsconfig.json +16 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Steph Ango (@kepano)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Defuddle CLI
|
|
2
|
+
|
|
3
|
+
Command line interface for [Defuddle](https://github.com/kepano/defuddle). Extract clean HTML or Markdown from pages.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @defuddle/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
defuddle parse <source> [options]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Arguments
|
|
18
|
+
|
|
19
|
+
- `source`: HTML file path or URL to parse
|
|
20
|
+
|
|
21
|
+
### Options
|
|
22
|
+
|
|
23
|
+
- `-o, --output <file>`: Output file path (default: stdout)
|
|
24
|
+
- `-m, --markdown, --md`: Convert content to markdown
|
|
25
|
+
- `-j, --json`: Output as JSON with both HTML and markdown content
|
|
26
|
+
- `-p, --property <name>`: Extract a specific property (e.g., title, description, domain)
|
|
27
|
+
- `--debug`: Enable debug mode
|
|
28
|
+
- `-h, --help`: Display help for command
|
|
29
|
+
|
|
30
|
+
### Examples
|
|
31
|
+
|
|
32
|
+
Parse a local HTML file (outputs HTML):
|
|
33
|
+
```bash
|
|
34
|
+
defuddle parse article.html
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Parse a URL and convert to markdown:
|
|
38
|
+
```bash
|
|
39
|
+
defuddle parse https://example.com/article --md
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Parse and get the full JSON response from Defuddle:
|
|
43
|
+
```bash
|
|
44
|
+
defuddle parse article.html --json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Save markdown output to a file:
|
|
48
|
+
```bash
|
|
49
|
+
defuddle parse article.html --md -o output.md
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Extract specific properties:
|
|
53
|
+
```bash
|
|
54
|
+
# Get just the title
|
|
55
|
+
defuddle parse article.html --property title
|
|
56
|
+
|
|
57
|
+
# Get the description
|
|
58
|
+
defuddle parse article.html -p description
|
|
59
|
+
|
|
60
|
+
# Get the domain
|
|
61
|
+
defuddle parse article.html --property domain
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Install dependencies
|
|
68
|
+
npm install
|
|
69
|
+
|
|
70
|
+
# Build
|
|
71
|
+
npm run build
|
|
72
|
+
|
|
73
|
+
# Run in development mode
|
|
74
|
+
npm run dev
|
|
75
|
+
```
|
package/dist/index.d.ts
ADDED