defuddle 0.3.1 → 0.3.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 +16 -1
- package/dist/defuddle.d.ts +2 -1
- package/dist/index.full.d.ts +3 -0
- package/dist/index.full.js +1 -0
- package/dist/index.js +1 -1
- package/dist/math.base.d.ts +9 -0
- package/dist/math.core.d.ts +7 -0
- package/dist/math.d.ts +2 -14
- package/dist/math.full.d.ts +8 -0
- package/package.json +20 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Defuddle aims to output clean and consistent HTML documents. It was written for
|
|
|
12
12
|
Defuddle can be used as a replacement for [Mozilla Readability](https://github.com/mozilla/readability) with a few differences:
|
|
13
13
|
|
|
14
14
|
- More forgiving, removes fewer uncertain elements.
|
|
15
|
-
- Provides a consistent output for footnotes,
|
|
15
|
+
- Provides a consistent output for footnotes, math, code blocks, etc.
|
|
16
16
|
- Uses a page's mobile styles to guess at unnecessary elements.
|
|
17
17
|
- Extracts more metadata from the page, including schema.org data.
|
|
18
18
|
|
|
@@ -34,6 +34,21 @@ console.log(article.content); // HTML string of the main content
|
|
|
34
34
|
console.log(article.title); // Title of the article
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
### Bundles
|
|
38
|
+
|
|
39
|
+
Defuddle comes in two bundles:
|
|
40
|
+
|
|
41
|
+
**Core bundle** (~50kB), no dependencies
|
|
42
|
+
```js
|
|
43
|
+
import { Defuddle } from 'defuddle';
|
|
44
|
+
```
|
|
45
|
+
**Full bundle** (~432kB), includes advanced math conversion capabilities
|
|
46
|
+
```js
|
|
47
|
+
import { Defuddle } from 'defuddle/full';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
37
52
|
### Debug mode
|
|
38
53
|
|
|
39
54
|
You can enable debug mode by passing an options object when creating a new Defuddle instance:
|
package/dist/defuddle.d.ts
CHANGED
|
@@ -21,8 +21,9 @@ export declare class Defuddle {
|
|
|
21
21
|
private removeClutter;
|
|
22
22
|
private flattenDivs;
|
|
23
23
|
private cleanContent;
|
|
24
|
+
private standardizeSpaces;
|
|
24
25
|
private removeTrailingHeadings;
|
|
25
|
-
private
|
|
26
|
+
private standardizeHeadings;
|
|
26
27
|
private removeHtmlComments;
|
|
27
28
|
private stripUnwantedAttributes;
|
|
28
29
|
private removeEmptyElements;
|