pub struct Html { /* private fields */ }Expand description
How a document is written as HTML: what its URLs become, and who renders a fenced block.
Implementations§
Source§impl Html
impl Html
Sourcepub fn stylesheet(
light: &Theme,
dark: &Theme,
typography: &Typography,
) -> String
pub fn stylesheet( light: &Theme, dark: &Theme, typography: &Typography, ) -> String
CSS for the markup Html::render writes, inside an element of class
md. Colors are custom properties on .md, light’s by default and
dark’s under prefers-color-scheme: dark; sizes are in px from
typography at the theme’s base text size; fonts are light’s.
Source§impl Html
impl Html
pub fn new() -> Self
Sourcepub fn url(self, url: impl Fn(&str) -> String + 'static) -> Self
pub fn url(self, url: impl Fn(&str) -> String + 'static) -> Self
What every URL in the document — a link’s, a mention’s, a bookmark’s, a picture’s — is written as. Without one, each is written as it is.
Sourcepub fn fence(
self,
fence: impl Fn(&str, &str) -> Option<String> + 'static,
) -> Self
pub fn fence( self, fence: impl Fn(&str, &str) -> Option<String> + 'static, ) -> Self
The markup for a fenced block, from its language and its code, or
None to write it as <pre><code>. The markup is written unescaped.
Sourcepub fn highlighter(self, highlighter: Highlighter) -> Self
pub fn highlighter(self, highlighter: Highlighter) -> Self
What colors a fenced block Html::fence leaves as <pre><code>.
pub fn render(&self, doc: &Doc) -> String
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Html
impl !Send for Html
impl !Sync for Html
impl !UnwindSafe for Html
impl Forget for Html
impl Freeze for Html
impl Move for Html
impl Unpin for Html
impl UnsafeUnpin for Html
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().