addStylesheet

Adds stylesheet as a resource and marks it for auto-linking from every XHTML page at write time.

Idempotent on the existing resource if it has the same bytes — so a UI layer that calls book.addStylesheet(Stylesheets.defaultReader()) once per composition won't crash when the same Book reaches a second reader instance. Throws IllegalArgumentException only when a different resource (different bytes) is already registered at the same href; pass a unique Stylesheet(href = ...) in that case.

Books written with the default io.documentnode.epub4kmp.epub.EpubWriter pipeline load and rewrite every XHTML page to inject <link> tags. Lazy-loaded XHTML (lazyLoadedTypes = listOf(MediaTypes.XHTML)) is fully materialized for that write.