satteri
Functions
headings()
function headings(): MdastPluginEntry;Collects every heading of a document as { depth, slug, text }, publishes the list as data.headings, and gives each heading an id matching its slug so an anchor link lands on it. On MDX the list is also appended to the tree as export const headings, so the compiled module carries its own table of contents.
The plugin is a factory rather than a definition because Sätteri resolves a factory once per compile: a single headings() shared by a whole build gets fresh slug state per document, instead of the second document's notes reading notes-1.
The definition is written out rather than passed through Sätteri's defineMdastPlugin, whose entire body checks that name is set. Calling it would make this module import the satteri package, and render.ts imports this module: a Worker bundle whose collections contentLayer() already prebuilt would then have to resolve a native addon it can never load.
Returns
MdastPluginEntry
rawStyles()
function rawStyles(): HastPluginEntry;Hands a <style> element's CSS to Remix as markup rather than as text, so the stylesheet survives being rendered.
@remix-run/ui escapes &, <, and > in the text children of every element except <script>, and emits an innerHTML prop verbatim. <style> is a raw-text element, which is exactly the case where a browser does not undo that escaping: a rule written pre > code reaches the page as pre > code, matches nothing, and says nothing. Expressive Code is how most applications meet this, because it ships its theme as one such element.
A workaround, not a design. The fix belongs in @remix-run/ui, which already special-cases <script> and should treat <style> the same way. <script> is deliberately not touched here: routing it through innerHTML would skip escapeScriptTextContent, which keeps a </script> inside a string from ending the element early.
Returns
HastPluginEntry