defuddle 0.3.6 → 0.3.8
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 +6 -4
- package/dist/elements/math.core.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.full.d.ts +2 -1
- package/dist/index.full.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
Defuddle extracts the main content from web pages. It cleans up web pages by removing clutter like comments, sidebars, headers, footers, and other non-essential elements, leaving only the primary content.
|
|
7
7
|
|
|
8
|
+
[Try the Defuddle Playground →](https://kepano.github.io/defuddle/)
|
|
9
|
+
|
|
8
10
|
## Features
|
|
9
11
|
|
|
10
12
|
Defuddle aims to output clean and consistent HTML documents. It was written for [Obsidian Web Clipper](https://github.com/obsidianmd/obsidian-clipper) with the goal of creating a more useful input for HTML-to-Markdown converters like [Turndown](https://github.com/mixmark-io/turndown).
|
|
@@ -25,7 +27,7 @@ npm install defuddle
|
|
|
25
27
|
## Usage
|
|
26
28
|
|
|
27
29
|
```typescript
|
|
28
|
-
import
|
|
30
|
+
import Defuddle from 'defuddle';
|
|
29
31
|
|
|
30
32
|
const article = new Defuddle(document).parse();
|
|
31
33
|
|
|
@@ -40,11 +42,11 @@ Defuddle comes in two bundles:
|
|
|
40
42
|
|
|
41
43
|
**Core bundle** (~50kB), no dependencies
|
|
42
44
|
```js
|
|
43
|
-
import
|
|
45
|
+
import Defuddle from 'defuddle';
|
|
44
46
|
```
|
|
45
47
|
**Full bundle** (~432kB), includes advanced math conversion capabilities
|
|
46
48
|
```js
|
|
47
|
-
import
|
|
49
|
+
import Defuddle from 'defuddle/full';
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
The core bundle is recommended for most use cases. It still handles math content, but doesn't include fallbacks for converting between MathML and LaTeX formats. The full bundle adds the ability to create reliable `<math>` elements using `mathml-to-latex` and `temml` libraries.
|
|
@@ -67,7 +69,7 @@ const article = new Defuddle(document, { debug: true }).parse();
|
|
|
67
69
|
When using Defuddle in a Node.js environment, you can use JSDOM to create a DOM document:
|
|
68
70
|
|
|
69
71
|
```typescript
|
|
70
|
-
import
|
|
72
|
+
import Defuddle from 'defuddle';
|
|
71
73
|
import { JSDOM } from 'jsdom';
|
|
72
74
|
|
|
73
75
|
const html = '...'; // Your HTML string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MathData } from './math.base';
|
|
2
|
-
export declare const createCleanMathEl: (mathData: MathData | null, latex: string | null, isBlock: boolean) => Element;
|
|
2
|
+
export declare const createCleanMathEl: (doc: Document, mathData: MathData | null, latex: string | null, isBlock: boolean) => Element;
|
|
3
3
|
export declare const mathRules: {
|
|
4
4
|
selector: string;
|
|
5
5
|
element: string;
|
package/dist/index.d.ts
CHANGED
package/dist/index.full.d.ts
CHANGED