Skip to main content

Module widgets

Module widgets 

Source
Expand description

Widgets: React components used as capitalized HTML tags in Markdown.

On the server a page’s widget tags become placeholder elements carrying the widget’s name, its props’ source and its content ([tags]), which comrak renders as Markdown. In the browser the page script loads React and the widgets, compiled here from TSX by oxc ([compile]), and mounts each placeholder. What was read and compiled is kept in a Modules cache.

This module is the widget set a document has: its names, the address each is served at, and what a page loads.

Re-exports§

pub use crate::markup::NOTES;

Structs§

Modules
What was read and compiled, shared by every handle to it.
Snapshot
The files a module is made from, each read once: the module and every module its relative imports reach inside the served folder. Its version and its compiled bytes both come from one snapshot, so a save landing between the two can’t serve new bytes under the old version.
Widgets
The widgets a document’s pages can use: name → the address its module is served at.

Constants§

SIDEBAR
The widget that is a site’s sidebar: devpage’s own chrome, mounted by the page script on the sidebar the server rendered, never written in a page. Its Devpage prefix keeps it clear of a project’s names: a project may have its own Sidebar.
SYSTEM
The widgets devpage ships, compiled into the binary.

Functions§

expand
Replaces the tags of the widgets named in known in Markdown with placeholder elements, leaving code alone, and takes <Notes> out. An unknown capitalized tag, and a Tab outside a Tabs, are reported; an unknown tag is replaced by an error in its place rather than passed through as HTML.
is_widget_file
Whether path is a widget or helper file: a .ts or .tsx directly in a widgets folder.
system
The source of a system widget, by name.