MCPcopy Create free account
hub / github.com/Stranger6667/css-inline / inline_fragment

Method inline_fragment

css-inline/src/lib.rs:612–616  ·  view source on GitHub ↗

Inline CSS into an HTML fragment. Unlike [`inline`](CSSInliner::inline), this method does not wrap the output in ` ` and ` ` tags. Structural tags (` `, ` `, ` `) are stripped from the output; only their contents are preserved. CSS from ` ` tags within the input is also processed and inlined. If you need to preserve the full HTML document structure, use [`inline`](

(&self, html: &str, css: &str)

Source from the content-addressed store, hash-verified

610 /// This function may panic if external stylesheet cache lock is poisoned, i.e. another thread
611 /// using the same inliner panicked while resolving external stylesheets.
612 pub fn inline_fragment(&self, html: &str, css: &str) -> Result<String> {
613 let mut out = allocate_output_buffer(html);
614 self.inline_fragment_to(html, css, &mut out)?;
615 Ok(String::from_utf8_lossy(&out).to_string())
616 }
617
618 /// Inline CSS into an HTML fragment and write the result to a generic writer.
619 ///

Callers 1

inline_fragmentFunction · 0.45

Calls 2

allocate_output_bufferFunction · 0.85
inline_fragment_toMethod · 0.80

Tested by

no test coverage detected