Skip to main content

Crate freya_html

Crate freya_html 

Source
Expand description

Render inline or remote HTML and CSS in a Freya component using Blitz.

use freya_html::prelude::*;

let handle = use_html(|| HtmlSource::html("<h1>Hello!</h1>"));
HtmlViewer::new(handle).expanded()

Configure inline documents with HtmlContent, including a validated base URL through HtmlContent::with_base_url.

Use HtmlSource::url to load a remote page. Add local fonts with HtmlViewer::font. On web, provide a font for inline documents or load one through CSS @font-face.

For HTTP requests outside the viewer, enable Freya’s remote-asset feature and use freya_components::http::fetch:

let url = freya_components::Url::parse("https://example.com")?;
let bytes = freya_components::http::fetch(url).await?;

Modules§

prelude

Structs§

ElementHit
HtmlContent
Inline HTML and its optional base URL for resolving relative resources and links. Static HTML is borrowed, while dynamically generated HTML is owned.
HtmlHandle
Controls an HtmlViewer, its navigation and its browsing history.
HtmlViewer
Embeds an HTML + CSS document rendered by Blitz, driven by an HtmlHandle.
ResourceCache
Shared LRU cache with a 32 MiB default body budget.

Enums§

HtmlSource
A document for an HtmlViewer, either remote or inline.

Functions§

use_html
Creates an HtmlHandle starting at the source returned by init.