[][src]Struct termimad::MadSkin

pub struct MadSkin {
    pub paragraph: LineStyle,
    pub bold: CompoundStyle,
    pub italic: CompoundStyle,
    pub strikeout: CompoundStyle,
    pub inline_code: CompoundStyle,
    pub code_block: LineStyle,
    pub headers: [LineStyle; 8],
    pub scrollbar: ScrollBarStyle,
    pub table: LineStyle,
    pub bullet: StyledChar,
    pub quote_mark: StyledChar,
    pub horizontal_rule: StyledChar,
}

A skin defining how a parsed mardkown appears on the terminal (fg and bg colors, bold, italic, underline, etc.)

Fields

paragraph: LineStylebold: CompoundStyleitalic: CompoundStylestrikeout: CompoundStyleinline_code: CompoundStylecode_block: LineStyleheaders: [LineStyle; 8]scrollbar: ScrollBarStyletable: LineStylebullet: StyledCharquote_mark: StyledCharhorizontal_rule: StyledChar

Methods

impl MadSkin[src]

pub fn set_headers_fg(&mut self, c: Color)[src]

Set a common foregreound color for all header levels

(it's still possible to change them individually with skin.headers[i])

pub fn set_headers_bg(&mut self, c: Color)[src]

Set a common background color for all header levels

(it's still possible to change them individually with skin.headers[i])

pub fn visible_composite_length(&self, composite: &Composite) -> usize[src]

Return the number of visible chars in a composite

pub fn visible_line_length(&self, line: &Line) -> usize[src]

pub fn inline<'k, 's>(&'k self, src: &'s str) -> FmtInline<'k, 's>[src]

pub fn text<'k, 's>(
    &'k self,
    src: &'s str,
    width: Option<usize>
) -> FmtText<'k, 's>
[src]

return a formatted text.

Code blocs will be right justified

pub fn term_text<'k, 's>(&'k self, src: &'s str) -> FmtText<'k, 's>[src]

return a formatted text, with lines wrapped or justified for the current terminal width.

Code blocs will be right justified

pub fn area_text<'k, 's>(&'k self, src: &'s str, area: &Area) -> FmtText<'k, 's>[src]

return a formatted text, with lines wrapped or justified for the passed area width (with space for a scrollbar).

Code blocs will be right justified

pub fn write_in_area(&self, markdown: &str, area: &Area) -> Result<()>[src]

pub fn print_inline(&self, src: &str)[src]

pub fn print_text(&self, src: &str)[src]

pub fn write_fmt_composite(
    &self,
    f: &mut Formatter,
    fc: &FmtComposite,
    outer_width: Option<usize>,
    with_right_completion: bool
) -> Result
[src]

Write a composite.

This function is internally used and normally not needed outside of Termimad's implementation.

pub fn write_fmt_line(
    &self,
    f: &mut Formatter,
    line: &FmtLine,
    width: Option<usize>,
    with_right_completion: bool
) -> Result
[src]

Write a line in the passed formatter, with completions.

Right completion is optional because:

  • if a text isn't right completed it shrinks better when you reduce the width of the terminal
  • right completion is useful to overwrite previous rendering without flickering (in scrollable views)

Trait Implementations

impl Default for MadSkin[src]

fn default() -> MadSkin[src]

Build a customizable skin.

It's initialized with sensible monochrome settings.

Auto Trait Implementations

impl Sync for MadSkin

impl Send for MadSkin

impl Unpin for MadSkin

impl RefUnwindSafe for MadSkin

impl UnwindSafe for MadSkin

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]