The out-of-process carrier of a runtime language: JSON over stdio. Needs
the json feature, since fig reads and writes the wire itself.
The out-of-process carrier: a Language served to a fig binary as
JSON over stdin and stdout. serve is the request loop a helper
executable runs; the wire format below is what the fig CLI’s helper
runner speaks, and what a helper in any other language implements.
Languages resolved at runtime: the Language trait, the node table its
parse returns, and register, which carries an implementation to the
core as a vtable and hands back a Format that every entry point of
this crate then accepts.
What this build of the fig core can do with a format. Reflects both inherent
support (every format the Format enum exposes parses, edits, and
serializes; the core’s reader-only XML is not surfaced here) and build-time
gating (a format compiled out reports all-false).
The result of Embed::extract: a located Region plus the borrowed host
text, with helpers to slice out the embedded content and the host text on
either side of it without parsing or copying.
Controls how Value::serialize_with renders output. The Default is
fig’s historical style (pretty-printed, two-space indent), so
Value::serialize is exactly serialize_with(format, SerializeOptions::default()).
A half-open [start, end) byte range: within the host file for an
embed’s Region, within the input for a runtime language’s node table.
Converts to and from a Range<usize>, so Span::from(0..5) builds one
and &source[Range::from(span)] slices by one.
Which embedded config to open — the flat mirror of fig’s parametric
Embed.Type. The three parametric families (markdown ---<lang>
frontmatter, ```<lang> fenced blocks, <script type> HTML data
islands) are enumerated once per format. Each name is the CLI’s archetype
name (--embed semicolons, --embed fenced-fig) in UpperCamelCase, as
the TypeScript binding’s string values are.
A config format: every format the core registers, plus
Format::Runtime for a language registered while the program runs.
Every compiled variant parses, edits, and serializes.
Best-effort sniff of which embed archetype source uses: try each known
archetype’s OPEN delimiter and return the first that matches, or None when
source opens none of them. Only the open delimiter is checked — an
unterminated block is still recognized as its archetype, so a follow-up
Embed::extract/Embed::open surfaces the real error instead of a
misleading “nothing found”. The counterpart to fig’s Language.detect, for
embeds.
Split source around its embedded region of kind without parsing or
copying: (before, content, after), the host text before the open fence,
the text between the fences, and the host text after the close fence. All
three borrow source. For frontmatter before is empty (or a UTF-8 BOM)
and after is the prose; for endmatter the other way round; for an HTML
data island both sides are host.