#[non_exhaustive]pub struct Options<S: StyleSheet = DefaultStyleSheet> { /* private fields */ }Expand description
Collection of optional parameters that influence markdown rendering.
The generic S allows users to provide their own theme type that implements the
StyleSheet trait. The default implementation is DefaultStyleSheet, which provides a
set of sensible defaults for styling markdown elements.
§Example
use tui_markdown::{DefaultStyleSheet, Options};
let options = Options::default();
// or with a custom style sheet
use ratatui_core::style::{Style, Stylize};
use tui_markdown::StyleSheet;
#[derive(Debug, Clone)]
struct MyStyleSheet;
impl StyleSheet for MyStyleSheet {
fn heading(&self, level: u8) -> Style {
Style::new().bold()
}
fn code(&self) -> Style {
Style::new().white().on_dark_gray()
}
fn link(&self) -> Style {
Style::new().blue().underlined()
}
fn blockquote(&self) -> Style {
Style::new().yellow()
}
fn heading_meta(&self) -> Style {
Style::new().dim()
}
fn metadata_block(&self) -> Style {
Style::new().light_yellow()
}
}
let options = Options::new(MyStyleSheet);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Options<S>where
S: Freeze,
impl<S> RefUnwindSafe for Options<S>where
S: RefUnwindSafe,
impl<S> Send for Options<S>
impl<S> Sync for Options<S>
impl<S> Unpin for Options<S>where
S: Unpin,
impl<S> UnwindSafe for Options<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more