pub struct Markstream { /* private fields */ }Expand description
One markstream container: Markdown, an optional stream URL and options.
use autumn_plugin_markstream::{Markstream, Mode};
use autumn_web::html;
let page = html! {
(Markstream::new("# Hello\n\nSome *Markdown*."))
(Markstream::stream("/chat/42/stream").mode(Mode::Chat))
};
assert!(page.into_string().contains("data-markstream-src"));Implementations§
Source§impl Markstream
impl Markstream
Sourcepub fn stream(url: impl Into<String>) -> Self
pub fn stream(url: impl Into<String>) -> Self
Streams Markdown from the Server-Sent Events at url.
Make the events with crate::sse::markstream_sse.
Sourcepub fn stream_from(self, url: impl Into<String>) -> Self
pub fn stream_from(self, url: impl Into<String>) -> Self
Streams more Markdown from url after the current content.
The URL must have the same origin as the page. An empty URL means no stream.
Sourcepub const fn mode(self, mode: Mode) -> Self
pub const fn mode(self, mode: Mode) -> Self
Sets the render mode. Without this call, markstream uses its own default mode.
Sourcepub const fn html_policy(self, policy: HtmlPolicy) -> Self
pub const fn html_policy(self, policy: HtmlPolicy) -> Self
Sets the HTML policy. The default is HtmlPolicy::Escape.
Sourcepub const fn theme(self, theme: Theme) -> Self
pub const fn theme(self, theme: Theme) -> Self
Sets the color theme. The default is Theme::Auto.
Sourcepub const fn typewriter(self, on: bool) -> Self
pub const fn typewriter(self, on: bool) -> Self
Animates new text when on is true.
Sourcepub const fn max_live_nodes(self, nodes: u32) -> Self
pub const fn max_live_nodes(self, nodes: u32) -> Self
Sets the maximum number of live nodes. 0 keeps all nodes live.
Trait Implementations§
Source§impl Clone for Markstream
impl Clone for Markstream
Source§impl Debug for Markstream
impl Debug for Markstream
Source§impl Default for Markstream
impl Default for Markstream
impl Eq for Markstream
Source§impl PartialEq for Markstream
impl PartialEq for Markstream
Source§impl Render for Markstream
impl Render for Markstream
impl StructuralPartialEq for Markstream
Auto Trait Implementations§
impl Forget for Markstream
impl Freeze for Markstream
impl RefUnwindSafe for Markstream
impl Send for Markstream
impl Sync for Markstream
impl Unpin for Markstream
impl UnsafeUnpin for Markstream
impl UnwindSafe for Markstream
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
Open a deferred
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.