Function eyeliner::inline
[−]
[src]
pub fn inline(
html: &str,
css: Option<&str>,
options: Option<Options>,
settings: Option<Settings>
) -> String
Returns a string of HTML with CSS inlined.
Arguments
html
- A string of HTML to have CSS inlined into. Any<style />
tags will have their styles parsed and processed.css
- An optional string of additional CSS to be inlined that is added before the<style />
tags in thehtml
are parsed.options
- An optional instance ofOptions
.settings
- An optional instance ofSettings
.
Remarks
Convenient function to inline HTML and CSS the same way as Juice.
Examples
use eyeliner::inline; let html = r#" <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <h1>Hello, world!</h1> <p>I <span class="red">love</span> Rust!</p> </body> </html> "#; let css = r#" .red { color: red; } "#; let fixture = r#" <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <h1>Hello, world!</h1> <p>I <span class="red" style="color: red;">love</span> Rust!</p> </body> </html> "#; assert_eq!( inline(fixture, None, None, None), // Just used to format the HTML the same way inline(html, Some(css), None, None), );