dashboard: render markdown file previews in the side panel
clicking a .md / .markdown path reference now opens a marked-rendered view in the slide-in panel instead of raw text; other files stay raw in a <pre>. serves the vendored marked bundle at /static/marked.js and scopes a .md stylesheet to the panel body.
This commit is contained in:
parent
f13c3dff8f
commit
0c62bbf1cd
4 changed files with 67 additions and 4 deletions
|
|
@ -65,6 +65,7 @@ pub async fn serve(port: u16, coord: Arc<Coordinator>) -> Result<()> {
|
|||
.route("/dashboard/stream", get(dashboard_stream))
|
||||
.route("/dashboard/history", get(dashboard_history))
|
||||
.route("/static/hive-fr0nt.js", get(serve_shared_js))
|
||||
.route("/static/marked.js", get(serve_marked_js))
|
||||
.with_state(AppState { coord });
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], port));
|
||||
let listener = bind_with_retry(addr).await?;
|
||||
|
|
@ -146,6 +147,15 @@ async fn serve_shared_js() -> impl IntoResponse {
|
|||
)
|
||||
}
|
||||
|
||||
/// Vendored `marked` bundle — the side panel renders markdown file
|
||||
/// previews with it.
|
||||
async fn serve_marked_js() -> impl IntoResponse {
|
||||
(
|
||||
[("content-type", "application/javascript")],
|
||||
hive_fr0nt::MARKED_JS,
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct StateSnapshot {
|
||||
/// Broker seq at the moment this snapshot was assembled. Clients
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue