Struct rhit::MadSkin [−][src]
A skin defining how a parsed mardkown appears on the terminal (fg and bg colors, bold, italic, underline, etc.)
Fields
paragraph: LineStyle
bold: CompoundStyle
italic: CompoundStyle
strikeout: CompoundStyle
inline_code: CompoundStyle
code_block: LineStyle
headers: [LineStyle; 8]
scrollbar: ScrollBarStyle
table: LineStyle
bullet: StyledChar
quote_mark: StyledChar
horizontal_rule: StyledChar
ellipsis: CompoundStyle
special_chars: HashMap<Compound<'static>, StyledChar, RandomState>
compounds which should be replaced with special renders. Experimental. This API will probably change (comments welcome) Do not use compounds with a length different than 1.
Implementations
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 set_global_bg(&mut self, c: Color)
[src]
set a common background for the paragraph, headers, rules, etc.
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 self, src: &'s str) -> FmtInline<'k, 's>
[src]
pub fn text(&'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 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 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<(), Error>
[src]
pub fn write_in_area_on<W>(
&self,
w: &mut W,
markdown: &str,
area: &Area
) -> Result<(), Error> where
W: Write,
[src]
&self,
w: &mut W,
markdown: &str,
area: &Area
) -> Result<(), Error> where
W: Write,
pub fn print_inline(&self, src: &str)
[src]
do a print!
of the given src interpreted as a markdown span
pub fn print_text(&self, src: &str)
[src]
do a print!
of the given src interpreted as a markdown text
pub fn print_expander(&self, expander: TextTemplateExpander<'_, '_>)
[src]
do a print!
of the given expander
pub fn print_composite(&self, composite: Composite<'_>)
[src]
pub fn write_composite<W>(
&self,
w: &mut W,
composite: Composite<'_>
) -> Result<(), Error> where
W: Write,
[src]
&self,
w: &mut W,
composite: Composite<'_>
) -> Result<(), Error> where
W: Write,
pub fn write_composite_fill<W>(
&self,
w: &mut W,
composite: Composite<'_>,
width: usize,
align: Alignment
) -> Result<(), Error> where
W: Write,
[src]
&self,
w: &mut W,
composite: Composite<'_>,
width: usize,
align: Alignment
) -> Result<(), Error> where
W: Write,
write a composite filling the given width
Ellision or truncation may occur, but no wrap
pub fn write_inline_on<W>(&self, w: &mut W, src: &str) -> Result<(), Error> where
W: Write,
[src]
W: Write,
parse the given src as a markdown snippet and write it on
the given Write
pub fn write_text_on<W>(&self, w: &mut W, src: &str) -> Result<(), Error> where
W: Write,
[src]
W: Write,
parse the given src as a markdown text and write it on
the given Write
pub fn write_inline(&self, src: &str) -> Result<(), Error>
[src]
parse the given src as a markdown snippet and write it on stdout
pub fn write_text(&self, src: &str) -> Result<(), Error>
[src]
parse the given src as a markdown text and write it on stdout
pub fn write_fmt_composite(
&self,
f: &mut Formatter<'_>,
fc: &FmtComposite<'_>,
outer_width: Option<usize>,
with_right_completion: bool
) -> Result<(), Error>
[src]
&self,
f: &mut Formatter<'_>,
fc: &FmtComposite<'_>,
outer_width: Option<usize>,
with_right_completion: bool
) -> Result<(), Error>
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<(), Error>
[src]
&self,
f: &mut Formatter<'_>,
line: &FmtLine<'_>,
width: Option<usize>,
with_right_completion: bool
) -> Result<(), Error>
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
Auto Trait Implementations
impl RefUnwindSafe for MadSkin
[src]
impl Send for MadSkin
[src]
impl Sync for MadSkin
[src]
impl Unpin for MadSkin
[src]
impl UnwindSafe for MadSkin
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<T> From<T> for T
[src]
impl<T> Fun for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a Tⓘ
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tⓘ
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,