pub struct HtmlLinked { /* private fields */ }Expand description
HTML formatter with CSS classes.
Generates HTML with CSS classes instead of inline styles. Requires external CSS files.
Use this for better performance and smaller HTML when serving multiple code blocks.
Use HtmlLinkedBuilder to create instances.
§When to use
- Multiple code blocks sharing the same theme (smaller HTML output)
- Need to customize or override styles with CSS
- Prefer separation of content and styling
§Example
use lumis::{HtmlLinkedBuilder, languages::Language, formatter::Formatter};
use std::io::Write;
let code = "print('Hello')";
let formatter = HtmlLinkedBuilder::new()
.lang(Language::Python)
.pre_class(Some("my-code".to_string()))
.build()
.unwrap();
let mut output = Vec::new();
formatter.format(code, &mut output).unwrap();
// Remember to include the corresponding CSS file for your themeImplementations§
Source§impl HtmlLinked
impl HtmlLinked
pub fn new( lang: Language, pre_class: Option<String>, highlight_lines: Option<HighlightLines>, header: Option<HtmlElement>, ) -> HtmlLinked
Trait Implementations§
Source§impl Clone for HtmlLinked
impl Clone for HtmlLinked
Source§fn clone(&self) -> HtmlLinked
fn clone(&self) -> HtmlLinked
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HtmlLinked
impl Debug for HtmlLinked
Source§impl Default for HtmlLinked
impl Default for HtmlLinked
Source§fn default() -> HtmlLinked
fn default() -> HtmlLinked
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HtmlLinked
impl RefUnwindSafe for HtmlLinked
impl Send for HtmlLinked
impl Sync for HtmlLinked
impl Unpin for HtmlLinked
impl UnwindSafe for HtmlLinked
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more