Skip to main content

MarkdownStyle

Struct MarkdownStyle 

Source
pub struct MarkdownStyle {
Show 39 fields pub h1_icon: &'static str, pub h2_icon: &'static str, pub h3_icon: &'static str, pub h4_icon: &'static str, pub h5_icon: &'static str, pub h6_icon: &'static str, pub h1_fg: Color, pub h1_bg: Color, pub h2_fg: Color, pub h2_bg: Color, pub h3_fg: Color, pub h3_bg: Color, pub h4_fg: Color, pub h4_bg: Color, pub h5_fg: Color, pub h5_bg: Color, pub h6_fg: Color, pub h6_bg: Color, pub bullet_l1: &'static str, pub bullet_l2: &'static str, pub bullet_l3: &'static str, pub code_block_border: bool, pub code_block_bg: Color, pub inline_code_bg: Color, pub inline_code_fg: Color, pub quote_icon: &'static str, pub quote_fg: Color, pub quote_bg: Color, pub callout_note_icon: &'static str, pub callout_tip_icon: &'static str, pub callout_warning_icon: &'static str, pub callout_caution_icon: &'static str, pub text_fg: Color, pub text_bg: Color, pub link_fg: Color, pub emph_fg: Color, pub strong_fg: Color, pub hr_fg: Color, pub table_border_fg: Color,
}
Available on crate feature markdown-preview only.
Expand description

Configuration for markdown rendering styles.

This module provides the MarkdownStyle struct which configures the visual appearance of markdown elements including headings, code blocks, lists, and more. Configuration for markdown rendering styles.

This struct allows customization of all visual aspects of markdown rendering, including heading icons and colors, bullet point styles, code block appearance, and text colors.

§Example

use ratatui_toolkit::markdown_widget::extensions::theme::MarkdownStyle;

// Use default styling
let style = MarkdownStyle::default();

Fields§

§h1_icon: &'static str

Icon displayed before H1 headings (e.g., “* “).

§h2_icon: &'static str

Icon displayed before H2 headings (e.g., “* “).

§h3_icon: &'static str

Icon displayed before H3 headings (e.g., “* “).

§h4_icon: &'static str

Icon displayed before H4 headings (e.g., “* “).

§h5_icon: &'static str

Icon displayed before H5 headings (e.g., “* “).

§h6_icon: &'static str

Icon displayed before H6 headings (e.g., “* “).

§h1_fg: Color

Foreground color for H1 headings.

§h1_bg: Color

Background color for H1 headings.

§h2_fg: Color

Foreground color for H2 headings.

§h2_bg: Color

Background color for H2 headings.

§h3_fg: Color

Foreground color for H3 headings.

§h3_bg: Color

Background color for H3 headings.

§h4_fg: Color

Foreground color for H4 headings.

§h4_bg: Color

Background color for H4 headings.

§h5_fg: Color

Foreground color for H5 headings.

§h5_bg: Color

Background color for H5 headings.

§h6_fg: Color

Foreground color for H6 headings.

§h6_bg: Color

Background color for H6 headings.

§bullet_l1: &'static str

Bullet character for level 1 list items (e.g., “* “).

§bullet_l2: &'static str

Bullet character for level 2 list items (e.g., “* “).

§bullet_l3: &'static str

Bullet character for level 3 list items (e.g., “* “).

§code_block_border: bool

Whether to show a border around code blocks.

§code_block_bg: Color

Background color for code blocks.

§inline_code_bg: Color

Background color for inline code spans.

§inline_code_fg: Color

Foreground color for inline code spans.

§quote_icon: &'static str

Icon displayed at the start of blockquotes (e.g., “| “).

§quote_fg: Color

Foreground color for blockquote text.

§quote_bg: Color

Background color for blockquotes.

§callout_note_icon: &'static str

Icon for note callouts (e.g., “! “).

§callout_tip_icon: &'static str

Icon for tip callouts (e.g., “! “).

§callout_warning_icon: &'static str

Icon for warning callouts (e.g., “! “).

§callout_caution_icon: &'static str

Icon for caution callouts (e.g., “! “).

§text_fg: Color

Default foreground color for body text.

§text_bg: Color

Default background color for body text.

§link_fg: Color

Foreground color for hyperlinks.

§emph_fg: Color

Foreground color for emphasized (italic) text.

§strong_fg: Color

Foreground color for strong (bold) text.

§hr_fg: Color

Foreground color for horizontal rules.

§table_border_fg: Color

Foreground color for table borders.

Trait Implementations§

Source§

impl Clone for MarkdownStyle

Source§

fn clone(&self) -> MarkdownStyle

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MarkdownStyle

Default trait implementation for MarkdownStyle.

Source§

fn default() -> MarkdownStyle

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more