defuddle 0.3.0 → 0.3.2
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 +31 -2
- 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 +21 -2
package/README.md
CHANGED
|
@@ -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:
|
|
@@ -91,11 +106,13 @@ Defuddle attempts to standardize HTML elements to provide a consistent input for
|
|
|
91
106
|
|
|
92
107
|
### Headings
|
|
93
108
|
|
|
94
|
-
|
|
109
|
+
- The first H1 or H2 heading is removed if it matches the title.
|
|
110
|
+
- H1s are converted to H2s.
|
|
111
|
+
- Anchor links in H1 to H6 elements are removed and become plain headings.
|
|
95
112
|
|
|
96
113
|
### Code blocks
|
|
97
114
|
|
|
98
|
-
Code block are standardized
|
|
115
|
+
Code block are standardized. If present, line numbers and syntax highlighting are removed, but the language is retained and added as a data attribute and class.
|
|
99
116
|
|
|
100
117
|
```html
|
|
101
118
|
<pre>
|
|
@@ -123,6 +140,18 @@ Inline reference<sup id="fnref:1"><a href="#fn:1">1</a></sup>.
|
|
|
123
140
|
</div>
|
|
124
141
|
```
|
|
125
142
|
|
|
143
|
+
### Math
|
|
144
|
+
|
|
145
|
+
Math elements, including MathJax and KaTeX, are converted to standard MathML:
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline" data-latex="a \neq 0">
|
|
149
|
+
<mi>a</mi>
|
|
150
|
+
<mo>≠</mo>
|
|
151
|
+
<mn>0</mn>
|
|
152
|
+
</math>
|
|
153
|
+
```
|
|
154
|
+
|
|
126
155
|
## Development
|
|
127
156
|
|
|
128
157
|
### Build
|