EpubContent

fun EpubContent(book: Book, resource: Resource, modifier: Modifier = Modifier, backgroundColor: Color = MaterialTheme.colorScheme.surface, textColor: Color = MaterialTheme.colorScheme.onSurface, fragmentId: String? = null, onLinkClicked: (LinkClick) -> Unit? = null)(source)

Renders a single XHTML resource from book in a platform WebView.

Images, stylesheets, and embedded fonts referenced by the chapter are inlined as data: URIs so no per-platform request interception is needed.

The rendered page inherits backgroundColor and textColor, defaulting to the surrounding Material theme's surface / onSurface so dark mode and light mode both stay readable.

Parameters

fragmentId

if non-null, the WebView scrolls to the element with this id once the chapter has loaded — used to land on the right footnote or subsection after navigating from an <a href="ch.xhtml#fn-3"> link.

onLinkClicked

called when the user taps an <a> tag inside the chapter. The href is resolved against the chapter's path and the resolved LinkClick is delivered, ready to hand off to a io.documentnode.epub4kmp.browsersupport.Navigator. If null, link taps are ignored.