Creates the HTML dependency for the MAIDR JavaScript bundle.
Behavior is controlled by the use_cdn parameter:
If
TRUE: Use CDN (requires internet): the latest published maidr.js, asmaidr_cdn_url()resolves it, unlessmaidr.cdn_versionpins oneIf
FALSE(default): Use local bundled files (works offline; a reader whose language is not English fetches that language's pack when online, see below)If
NULL: Same asFALSE- use local bundled files
Value
A list of htmlDependency objects: the maidr bundle, preceded by
maidr-dotpad-config when a DotPad SDK location is configured and by
maidr-locale-config when a locale pack location is declared
Details
We default to local bundled assets for deterministic rendering. Previously
we auto-detected via curl::has_internet(); when internet was available
the CDN path was selected, which combined with a (now-fixed) malformed
nested-<html> HTML scaffold caused base R chart SVGs to render squished
in the upper-left of the viewport. Local assets match the ggplot path that
has always rendered correctly. Users who want CDN can still pass
use_cdn = TRUE explicitly.
When a DotPad SDK location is configured (see maidr-options), a
maidr-dotpad-config dependency precedes the maidr one: its head
declares the window.MAIDR_DOTPAD_* globals, and listing it first is what
puts them ahead of the bundle's <script> in the rendered document.
A document that loads the bundled copy also gets a maidr-locale-config
dependency ahead of the bundle. maidr.js fetches any language but English
as a locale pack from beside itself, and this package does not bundle the
packs, so its head declares window.maidrLocaleBaseUrl: the packs of the
bundled version on jsDelivr, unless the session names another place or
none (see maidr_locale_base_url() and maidr-options).
No stylesheet is declared. MAIDR styles its interface at runtime, and
since maidr 3.75.1 the published maidr.css is a placeholder with no
rules in it. The one stylesheet that does carry rules, maidr-math.css
(KaTeX, for LaTeX in AI chat responses), is fetched by maidr.js itself,
resolved against the URL it was loaded from – the CDN directory, or the
lib/ folder htmltools copies the bundle into.