Skip to main content

StyleSheet

Trait StyleSheet 

Source
pub trait StyleSheet:
    Clone
    + Send
    + Sync
    + 'static {
Show 22 methods // Provided methods fn heading(&self, level: u8) -> Style { ... } fn code(&self) -> Style { ... } fn link(&self) -> Style { ... } fn blockquote(&self) -> Style { ... } fn heading_meta(&self) -> Style { ... } fn metadata_block(&self) -> Style { ... } fn heading_marker(&self, level: u8) -> &str { ... } fn code_block_fence(&self) -> &str { ... } fn html(&self) -> Style { ... } fn math_inline(&self) -> Style { ... } fn math_display(&self) -> Style { ... } fn footnote_ref(&self) -> Style { ... } fn footnote_def(&self) -> Style { ... } fn definition_term(&self) -> Style { ... } fn definition_description(&self) -> Style { ... } fn alert(&self, kind: AlertKind) -> Style { ... } fn alert_icon(&self, kind: AlertKind) -> &str { ... } fn alert_label(&self, kind: AlertKind) -> &str { ... } fn table_header(&self) -> Style { ... } fn table_cell(&self) -> Style { ... } fn table_border(&self) -> Style { ... } fn image_alt(&self) -> Style { ... }
}
Expand description

Visual styles and symbols consumed by the renderer.

Every method has a default, which DefaultStyleSheet uses unchanged. Implementations only need to override the choices they want to customize.

Provided Methods§

Source

fn heading(&self, level: u8) -> Style

Style for a Markdown heading.

level is one-based (1 for # H1, …).

Source

fn code(&self) -> Style

Style for inline code spans and fenced code blocks when syntax highlighting is disabled.

Style for an inline or reference link’s visible label and appended destination.

Source

fn blockquote(&self) -> Style

Base style applied to blockquotes (> prefix and body text).

Source

fn heading_meta(&self) -> Style

Style for heading attribute metadata appended to the heading text.

Source

fn metadata_block(&self) -> Style

Style for metadata blocks (front matter).

Source

fn heading_marker(&self, level: u8) -> &str

Marker displayed before a Markdown heading.

level is one-based (1 for an H1, …). The renderer adds one separating space after a non-empty marker. Return an empty string to omit the marker and its separator.

Source

fn code_block_fence(&self) -> &str

Delimiter displayed above and below block code.

The renderer appends fenced-code info to the opening delimiter. Return an empty string to omit both delimiter lines.

Source

fn html(&self) -> Style

Style for raw HTML blocks and inline HTML tags.

Source

fn math_inline(&self) -> Style

Style for inline math ($...$).

Source

fn math_display(&self) -> Style

Style for display math ($$...$$).

Source

fn footnote_ref(&self) -> Style

Style for footnote references, rendered as [label].

Source

fn footnote_def(&self) -> Style

Style for footnote definitions, including the [label]: prefix.

Source

fn definition_term(&self) -> Style

Style for definition list terms.

Source

fn definition_description(&self) -> Style

Style for definition list descriptions, including the : prefix.

Source

fn alert(&self, kind: AlertKind) -> Style

Style for a GFM alert heading and body.

The generated icon and label are bold in addition to this base style.

Source

fn alert_icon(&self, kind: AlertKind) -> &str

Icon displayed before a GFM alert label.

Return an empty string to render the label without an icon.

Source

fn alert_label(&self, kind: AlertKind) -> &str

Label displayed after a GFM alert icon.

Return an empty string to render the icon without a label.

Source

fn table_header(&self) -> Style

Style patched onto cells in the table header row.

Properties set by this style override the same properties in an inline style. The style covers cell padding, while borders use Self::table_border.

Source

fn table_cell(&self) -> Style

Style patched onto ordinary table cells.

Properties set by this style override the same properties in an inline style. The style covers cell padding, while borders use Self::table_border.

Source

fn table_border(&self) -> Style

Style for the Unicode box-drawing characters around table cells.

This changes the presentation of the borders, not the box-drawing characters themselves.

Source

fn image_alt(&self) -> Style

Style for the [img] marker and text used to represent Markdown images.

The default is dim and italic. The renderer patches this over any enclosing inline style.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§