Expand description
Mashlib / SolidOS data-browser integration.
When a browser navigates to an RDF resource on a Solid server, the
Accept: text/html header signals that the user wants a rendered
view, not raw triples. This module generates a thin HTML wrapper
that loads the SolidOS mashlib bundle (from a CDN, a local path,
or an ES module URL) and lets it fetch + render the underlying data.
The approach is called the “databrowser hack” in the SolidOS community: the server never renders RDF itself — it delegates to the client-side pane system inside mashlib.
§Data-island optimisation
When the resource is small enough (≤ DATA_ISLAND_MAX_BYTES), its
JSON-LD representation is embedded inline as a
<script type="application/ld+json"> block. A companion reader
script patches $rdf.fetcher.load() to resolve from that island
first, eliminating one HTTP round-trip on every page load.
§Modes
| Mode | HTML template | Use case |
|---|---|---|
MashlibMode::Cdn | <script src="unpkg.com/mashlib@{version}/…"> | Zero-config default |
MashlibMode::Local | <script defer src="/mashlib.min.js"> | Operator bundles assets with actix-files |
MashlibMode::Module | <script type="module" src="{url}"> | LOSOS / custom shell |
Structs§
- Mashlib
Config - Mashlib integration configuration.
Enums§
- Mashlib
Mode - How to load the mashlib bundle.
Constants§
- DATA_
ISLAND_ MAX_ BYTES - Cap on how much JSON-LD we inline as a data island. 256 KiB covers any realistic profile, type index, or container listing.
Functions§
- escape_
for_ script_ block - Escape a JSON-LD string for embedding inside
<script type="application/ld+json">. - generate_
html - Generate the mashlib HTML wrapper page.
- should_
serve - Determine whether the server should return the mashlib HTML wrapper instead of the raw resource body.