You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`inline_style_tags`. Whether to inline CSS from "style" tags. Default: `true`
84
-
-`remove_style_tags`. Remove "style" tags after inlining. Default: `false`
85
-
-`base_url`. Base URL to resolve relative URLs. If you'd like to load stylesheets from your filesystem, use the `file://` scheme. Default: `None`
86
-
-`load_remote_stylesheets`. Whether remote stylesheets should be loaded or not. Default: `true`
87
-
-`extra_css`. Additional CSS to inline. Default: `None`
88
+
-`keep_style_tags`. Specifies whether to keep "style" tags after inlining. Default: `false`
89
+
-`base_url`. The base URL used to resolve relative URLs. If you'd like to load stylesheets from your filesystem, use the `file://` scheme. Default: `None`
90
+
-`load_remote_stylesheets`. Specifies whether remote stylesheets should be loaded. Default: `true`
91
+
-`extra_css`. Extra CSS to be inlined. Default: `None`
92
+
-`preallocate_node_capacity`. **Advanced**. Preallocates capacity for HTML nodes during parsing. This can improve performance when you have an estimate of the number of nodes in your HTML document. Default: `8`
88
93
89
-
If you'd like to skip CSS inlining for an HTML tag, add`data-css-inline="ignore"` attribute to it:
94
+
You can also skip CSS inlining for an HTML tag by adding the`data-css-inline="ignore"` attribute to it:
90
95
91
96
```html
92
97
<head>
@@ -100,7 +105,7 @@ If you'd like to skip CSS inlining for an HTML tag, add `data-css-inline="ignore
100
105
</html>
101
106
```
102
107
103
-
This attribute also allows you to skip `link` and `style` tags:
108
+
The `data-css-inline="ignore"` attribute also allows you to skip `link` and `style` tags:
104
109
105
110
```html
106
111
<head>
@@ -114,18 +119,33 @@ This attribute also allows you to skip `link` and `style` tags:
114
119
</html>
115
120
```
116
121
122
+
If you'd like to load stylesheets from your filesystem, use the `file://` scheme:
// Do something with inlined HTML, e.g. send an email
134
+
Ok(())
135
+
}
136
+
```
137
+
117
138
## Standards support & restrictions
118
139
119
-
`css-inline` is built on top of [cssparser](https://crates.io/crates/cssparser) and relies on its behavior for CSS parsing.
120
-
Notably:
140
+
`css-inline` is built on top of [html5ever](https://crates.io/crates/html5ever) and [cssparser](https://crates.io/crates/cssparser) and relies on their behavior for HTML & CSS parsing.
121
141
122
-
- Only HTML 5, XHTML is not supported;
123
-
- Only CSS 3;
124
-
- Only UTF-8 for string representation. Other document encodings are not yet supported.
142
+
- Only HTML 5is supported, not XHTML.
143
+
- Only CSS 3 is supported.
144
+
- Only UTF-8 encoding for string representation. Other document encodings are not yet supported.
125
145
126
146
## Bindings
127
147
128
-
There are bindings for Python and WebAssembly in the `bindings` directory.
148
+
We provide bindings for Python and WebAssembly. Check the `bindings` directory for more information.
129
149
130
150
## Command Line Interface
131
151
@@ -148,23 +168,23 @@ ARGS:
148
168
HTML tags, according to the corresponding CSS selectors.
149
169
When multiple documents are specified, they will be
150
170
processed in parallel, and each inlined file will be saved
151
-
with "inlined." prefix. E.g., for "example.html", there
152
-
will be "inlined.example.html".
171
+
with an "inlined." prefix. For example, for "example.html",
172
+
there will be "inlined.example.html".
153
173
154
174
OPTIONS:
155
175
--inline-style-tags
156
-
Whether to inline CSS from "style" tags. The default
157
-
value is `true`. To disable inlining from "style" tags
158
-
use `--inline-style-tags=false`.
176
+
Specifies whether to inline CSS from "style" tags.
177
+
To disable inlining from "style" tags use
178
+
`--inline-style-tags=false`.
159
179
160
-
--remove-style-tags
161
-
Remove "style" tags after inlining.
180
+
--keep-style-tags
181
+
Keep "style" tags after inlining.
162
182
163
183
--base-url
164
-
Used for loading external stylesheets via relative URLs.
184
+
The base URL used to resolve relative URLs.
165
185
166
186
--load-remote-stylesheets
167
-
Whether remote stylesheets should be loaded or not.
187
+
Specifies if remote stylesheets should be loaded or not.
168
188
169
189
--extra-css
170
190
Additional CSS to inline.
@@ -175,11 +195,15 @@ OPTIONS:
175
195
176
196
## Extra materials
177
197
178
-
If you want to know how this library was created & how it works internally, you could take a look at these articles:
198
+
If you're interested in learning how this library was created and how it works internally, check out these articles:
0 commit comments