1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! markstream for Autumn: render and stream Markdown with Maud and htmx.
//!
//! Add [`MarkstreamPlugin`] to the app. Put [`markstream_head()`] in the page
//! head. Render Markdown with [`Markstream`], and stream it with
//! [`sse::markstream_sse`]:
//!
//! ```rust,no_run
//! use autumn_plugin_markstream::sse::{markstream_sse, stream};
//! use autumn_plugin_markstream::{Markstream, MarkstreamPlugin, Mode, markstream_head};
//! use autumn_web::prelude::*;
//!
//! #[get("/")]
//! async fn index() -> Markup {
//! html! {
//! html {
//! head { (markstream_head()) }
//! body {
//! (Markstream::new("# Hello\n\nSome *Markdown*."))
//! (Markstream::stream("/answer").mode(Mode::Chat))
//! }
//! }
//! }
//! }
//!
//! #[get("/answer")]
//! async fn answer() -> impl IntoResponse {
//! markstream_sse(stream::iter(["## Answer\n", "Some ", "*text*."]))
//! }
//!
//! # async fn run() {
//! autumn_web::app()
//! .plugin(MarkstreamPlugin::new())
//! .routes(routes![index, answer])
//! .run()
//! .await;
//! # }
//! ```
//!
//! The crate vendors markstream-vue [`MARKSTREAM_VERSION`] and Vue
//! [`VUE_VERSION`] (runtime build). Autumn serves them from memory under
//! `/static/_plugins/markstream/`. The page needs no inline script and no
//! import map, so the default Autumn CSP works.
//!
//! # Limits
//!
//! - No syntax highlighting. Code blocks render as plain `<pre>`.
//! - No Mermaid, D2 or infographic. These blocks show their source.
//! - No KaTeX unless the page loads KaTeX as a global (`window.katex`).
//! - The browser does not reconnect a stream. A dropped stream shows the
//! error state.
pub use ;
pub use ;
pub use ;
pub use ;
/// Compiles the README code blocks as doctests.
;