Skip to main content

Module markdown

Module markdown 

Source
Expand description

Read-only Markdown, rendered to GPUI elements.

§What this component will not do

It does not execute HTML, and it does not swallow it. A fragment of raw HTML is rendered as the literal characters that were written, marked as unrendered. Interpreting it would let a document reach outside the reader’s text; dropping it would let a document delete its own content from view by wrapping it in a tag, which is worse than showing the tag.

It does not open links. A link shows its destination before it is taken — in the node it publishes and in hover help — and reports MarkdownEvent::LinkClicked. Whether that destination may be opened, and by what, is the host’s to decide.

It does not fetch images. This crate has no network and no asset resolution. An image is drawn as a placeholder naming its alt text and its source, and reported once as MarkdownEvent::ImageRequested; a host that has the bytes hands an element back through Markdown::image.

It does not guess at syntax. A code block is set in the mono face and publishes the fence’s info string exactly as it was written. Colour comes from host-supplied CodeSpans or from nowhere.

Re-exports§

pub use parse::Block;
pub use parse::CellAlign;
pub use parse::Document;
pub use parse::Inline;
pub use parse::ListEntry;

Modules§

parse
Markdown source turned into an owned tree, before anything is drawn.

Structs§

CodeBlock
A fenced block, as handed to a host that colours code.
CodeSpan
One coloured run of a code block, in byte offsets into its text.
ImageRequest
An image the document referred to and this crate did not fetch.
Markdown
A rendered Markdown document.

Enums§

MarkdownEvent
What a rendered document reports. It applies none of it.