Skip to contents

Generates a complete standalone HTML document with MAIDR.js that can be embedded in an iframe for isolation. Each iframe gets its own JavaScript context, avoiding MAIDR.js singleton pattern issues with multiple plots.

Usage

create_standalone_html(svg_content, use_cdn = NULL, page_fallback = FALSE)

Arguments

svg_content

Character vector of SVG content with maidr-data attribute

use_cdn

Logical. If TRUE, use CDN. If FALSE, use bundled files. If NULL (default), auto-detect based on internet availability.

page_fallback

Logical. When the CDN is used, fall back to the copy of the bundle the embedding page carries if the CDN load fails. Set by the knitr paths, which add that copy to the document with maidr_page_bundle_dependency(), and by maidr_widget(), which declares the same dependency on the widget.

Value

Character string of complete HTML document