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§
Structs§
- Element
Hit - Html
Content - Inline HTML and its optional base URL for resolving relative resources and links. Static HTML is borrowed, while dynamically generated HTML is owned.
- Html
Handle - Controls an HtmlViewer, its navigation and its browsing history.
- Html
Viewer - Embeds an HTML + CSS document rendered by Blitz, driven by an HtmlHandle.
- Resource
Cache - Shared LRU cache with a 32 MiB default body budget.
Enums§
- Html
Source - A document for an HtmlViewer, either remote or inline.
Functions§
- use_
html - Creates an HtmlHandle starting at the source returned by
init.