Skip to content

Commit d944ccd

Browse files
committed
docs: Reuse README.md in crate's docs
1 parent 559e43a commit d944ccd

4 files changed

Lines changed: 18 additions & 97 deletions

File tree

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ To use it in your project add the following line to your `dependencies` section
3838
css-inline = "0.7"
3939
```
4040

41-
Minimum Supported Rust Version is 1.53.
41+
Minimum Supported Rust Version is 1.54.
4242

4343
## Usage
4444

4545
```rust
46-
use css_inline;
47-
4846
const HTML: &str = r#"<html>
4947
<head>
5048
<title>Test</title>
@@ -67,7 +65,7 @@ fn main() -> Result<(), css_inline::InlineError> {
6765
`css-inline` can be configured by using `CSSInliner::options()` that implements the Builder pattern:
6866

6967
```rust
70-
use css_inline;
68+
const HTML: &str = "...";
7169

7270
fn main() -> Result<(), css_inline::InlineError> {
7371
let inliner = css_inline::CSSInliner::options()
@@ -93,8 +91,8 @@ There are bindings for Python and WebAssembly in the `bindings` directory.
9391

9492
`css-inline` provides a command-line interface:
9593

96-
```
97-
$ css-inline --help
94+
```text
95+
css-inline --help
9896
9997
css-inline inlines CSS into HTML documents.
10098
@@ -104,17 +102,20 @@ USAGE:
104102
105103
ARGS:
106104
<PATH>...
107-
An HTML document to process. In each specified document "css-inline" will look for
108-
all relevant "style" and "link" tags, will load CSS from them and then inline it
109-
to the HTML tags, according to the corresponding CSS selectors.
110-
When multiple documents are specified, they will be processed in parallel, and each inlined
111-
file will be saved with "inlined." prefix. E.g., for "example.html", there will be
112-
"inlined.example.html".
105+
An HTML document to process. In each specified document
106+
"css-inline" will look for all relevant "style" and "link"
107+
tags, will load CSS from them and then inline it to the
108+
HTML tags, according to the corresponding CSS selectors.
109+
When multiple documents are specified, they will be
110+
processed in parallel, and each inlined file will be saved
111+
with "inlined." prefix. E.g., for "example.html", there
112+
will be "inlined.example.html".
113113
114114
OPTIONS:
115115
--inline-style-tags
116-
Whether to inline CSS from "style" tags. The default value is `true`. To disable inlining
117-
from "style" tags use `--inline-style-tags=false`.
116+
Whether to inline CSS from "style" tags. The default
117+
value is `true`. To disable inlining from "style" tags
118+
use `--inline-style-tags=false`.
118119
119120
--remove-style-tags
120121
Remove "style" tags after inlining.

bindings/python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pip install css_inline
2828
```
2929

3030
Pre-compiled wheels for most popular platforms are provided. If your platform is not in the support table below, you will need
31-
a Rust compiler to build this package from source. The minimum supported Rust version is 1.53.
31+
a Rust compiler to build this package from source. The minimum supported Rust version is 1.54.
3232

3333
Usage
3434
-----

bindings/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def call_setup():
4343
if platform.python_implementation() == "PyPy"
4444
else ["pyo3/abi3-py36"]
4545
),
46-
rust_version=">=1.53.0",
46+
rust_version=">=1.54.0",
4747
)
4848
],
4949
classifiers=[

css-inline/src/lib.rs

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,4 @@
1-
//! # css-inline
2-
//!
3-
//! A crate for inlining CSS into HTML documents. When you send HTML emails, you need to use "style"
4-
//! attributes instead of "style" tags.
5-
//!
6-
//! For example, this HTML:
7-
//!
8-
//! ```html
9-
//! <html>
10-
//! <head>
11-
//! <title>Test</title>
12-
//! <style>h1 { color:blue; }</style>
13-
//! </head>
14-
//! <body>
15-
//! <h1>Big Text</h1>
16-
//! </body>
17-
//! </html>
18-
//! ```
19-
//!
20-
//! Will be turned into this:
21-
//!
22-
//! ```html
23-
//! <html>
24-
//! <head><title>Test</title></head>
25-
//! <body>
26-
//! <h1 style="color:blue;">Big Text</h1>
27-
//! </body>
28-
//! </html>
29-
//! ```
30-
//!
31-
//! ## Usage
32-
//!
33-
//! ```rust
34-
//! const HTML: &str = r#"<html>
35-
//! <head>
36-
//! <title>Test</title>
37-
//! <style>h1 { color:blue; }</style>
38-
//! </head>
39-
//! <body>
40-
//! <h1>Big Text</h1>
41-
//! </body>
42-
//! </html>"#;
43-
//!
44-
//!fn main() -> Result<(), css_inline::InlineError> {
45-
//! let inlined = css_inline::inline(HTML)?; // shortcut with default options
46-
//! // Do something with inlined HTML, e.g. send an email
47-
//! Ok(())
48-
//! }
49-
//! ```
50-
//!
51-
//! ### Features & Configuration
52-
//!
53-
//! `css-inline` can be configured by using `CSSInliner::options()` that implements the Builder pattern:
54-
//!
55-
//! ```rust
56-
//! const HTML: &str = r#"<html>
57-
//! <head>
58-
//! <title>Test</title>
59-
//! <style>h1 { color:blue; }</style>
60-
//! </head>
61-
//! <body>
62-
//! <h1>Big Text</h1>
63-
//! </body>
64-
//! </html>"#;
65-
//!
66-
//! fn main() -> Result<(), css_inline::InlineError> {
67-
//! let inliner = css_inline::CSSInliner::options()
68-
//! .load_remote_stylesheets(false)
69-
//! .build();
70-
//! let inlined = inliner.inline(HTML);
71-
//! // Do something with inlined HTML, e.g. send an email
72-
//! Ok(())
73-
//! }
74-
//! ```
75-
//!
76-
//! - `inline_style_tags`. Whether to inline CSS from "style" tags. Default: `true`
77-
//! - `remove_style_tags`. Remove "style" tags after inlining. Default: `false`
78-
//! - `base_url`. Base URL to resolve relative URLs. Default: `None`
79-
//! - `load_remote_stylesheets`. Whether remote stylesheets should be loaded or not. Default: `true`
80-
//! - `extra_css`. Additional CSS to inline. Default: `None`
81-
//!
1+
#![doc = include_str!("../../README.md")]
822
#![warn(
833
clippy::doc_markdown,
844
clippy::redundant_closure,

0 commit comments

Comments
 (0)