zorite_markdown/lib.rs
1//! Zorite's **reader** view: a small read-only markdown renderer for GPUI.
2//! (Editing — WYSIWYG and raw — is the separate `zorite-editor` crate; the two
3//! engines share nothing, so any markdown behavior added here must be checked
4//! there and vice versa. See AGENTS.md "The three views".)
5//!
6//! It parses markdown to an AST (via the `markdown` crate) and renders
7//! it with gpui's own `StyledText` / `InteractiveText`, so paragraphs
8//! wrap properly and links are clickable through a real callback — not
9//! `cx.open_url`, which only opens externally.
10//!
11//! It is deliberately host-agnostic: styling comes in via [`MarkdownStyle`],
12//! and clicking a `[[wiki-link]]` invokes a caller-supplied closure
13//! (`on_wiki_link`) rather than knowing anything about the host app.
14//! Standard `[text](url)` links open externally via `cx.open_url`.
15//!
16//! Covers CommonMark + GFM: headings, paragraphs, bold/italic/strikethrough/
17//! inline-code, fenced code blocks, ordered/unordered/nested and task lists,
18//! blockquotes, thematic breaks, hard breaks, tables, links (inline and
19//! reference-style), images (rendered by the host via `on_image`), footnotes,
20//! and raw HTML (shown literally, never executed — except `<mark>`, which renders
21//! as highlighted text). `[[wiki-links]]` and `#tags` become clickable via caller
22//! callbacks.
23
24pub mod syntax;
25
26#[cfg(feature = "view")]
27mod view;
28#[cfg(feature = "view")]
29pub use view::*;