pub struct HtmlRenderer { /* private fields */ }Expand description
Renders HTML for tuika’s structured markdown block seam.
One value serves both raw block HTML and ```html fences. Attach it with
Markdown::block_renderer.
use tuika::prelude::*;
use tuika_html::HtmlRenderer;
let renderer = HtmlRenderer::new();
let doc = Markdown::new("<ul><li>one</li><li>two</li></ul>")
.block_renderer(&renderer);
cargo run -p tuika-html --example html_markdown is the scene above.
Implementations§
Source§impl HtmlRenderer
impl HtmlRenderer
Sourcepub fn new() -> Self
pub fn new() -> Self
A renderer with the default Limits.
Examples found in repository?
examples/html_markdown/main.rs (line 36)
35 fn render(&self, area: ratatui_core::layout::Rect, surface: &mut Surface, ctx: &RenderCtx) {
36 let html = HtmlRenderer::new();
37 let inner = ratatui_core::layout::Rect {
38 x: area.x.saturating_add(2),
39 y: area.y.saturating_add(1),
40 width: area.width.saturating_sub(4),
41 height: area.height.saturating_sub(2),
42 };
43 Markdown::new(DOCUMENT)
44 .block_renderer(&html)
45 .render(inner, surface, ctx);
46 }Sourcepub fn with_limits(limits: Limits) -> Self
pub fn with_limits(limits: Limits) -> Self
A renderer with custom Limits.
Trait Implementations§
Source§impl Clone for HtmlRenderer
impl Clone for HtmlRenderer
Source§fn clone(&self) -> HtmlRenderer
fn clone(&self) -> HtmlRenderer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for HtmlRenderer
Source§impl Debug for HtmlRenderer
impl Debug for HtmlRenderer
Source§impl Default for HtmlRenderer
impl Default for HtmlRenderer
Source§fn default() -> HtmlRenderer
fn default() -> HtmlRenderer
Returns the “default value” for a type. Read more
Source§impl MarkdownBlockRenderer for HtmlRenderer
impl MarkdownBlockRenderer for HtmlRenderer
Source§fn render(
&self,
block: MarkdownBlock<'_>,
context: MarkdownBlockContext<'_>,
) -> Option<Vec<Line<'static>>>
fn render( &self, block: MarkdownBlock<'_>, context: MarkdownBlockContext<'_>, ) -> Option<Vec<Line<'static>>>
Render
block at the current width and styling context.Auto Trait Implementations§
impl Freeze for HtmlRenderer
impl RefUnwindSafe for HtmlRenderer
impl Send for HtmlRenderer
impl Sync for HtmlRenderer
impl Unpin for HtmlRenderer
impl UnsafeUnpin for HtmlRenderer
impl UnwindSafe for HtmlRenderer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more