Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofmodule highlight.module·originates fromworld 07158574-5…

yaml

YAML syntax highlighter. Pure `(text) -> { Segment }`. Mirrors the algorithm of the deleted Rust `highlight_yaml` / `highlight_yaml_content` / `highlight_yaml_scalar` trio (renderer.rs): per-line comment splitting, `key: value` recognition (split on first `:`), and scalar typing…

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2mo ago
What it does

yaml

YAML syntax highlighter. Pure (text) -> { Segment }. Mirrors the algorithm of the deleted Rust highlight_yaml / highlight_yaml_content / highlight_yaml_scalar trio (renderer.rs): per-line comment splitting, key: value recognition (split on first :), and scalar typing (quoted string / true|false|null / numeric / plain). Colors flow from ui.getToken("code.<role>") via the active theme; hardcoded fallbacks match the deleted Rust values when no theme is active.

Exports

  • highlight(text: string) -> { Segment } — tokenize a YAML string into colored segments for the zui code renderer. The module returns this function directly.

Types:

  • Segment = { text: string, color: string, monospace: boolean }

Usage

local highlight = require("@builtin::modules.zui.highlight.yaml")
local segments  = highlight("name: zero\n# comment\n")

Notes

  • The module-level color upvalues are reassigned at every highlighter entry so the inner scalar/content helpers see the active palette without per-call args. Multiple concurrent calls are NOT safe — this module is designed for serial UI rendering.
  • Numeric detection allows ., -, + alongside digits, so dotted versions and negatives parse as numbers (matches the Rust behaviour).

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

ZuiHighlightYaml Module YAML syntax highlighter. Pure `(text) -> { Segment }`. Mirrors the algorithm of the deleted Rust `highlight_yaml` / `highlight_yaml_content` / `highlight_yaml_scalar` trio (renderer.rs): per-line comment splitting, `key: value` recognition (split on first `:`), and scalar typing (quoted string / true|false|null / numeric / plain). Colors flow from `ui.getToken("code.<role>")` via the active theme. Hardcoded fallbacks below match the deleted Rust values when no theme is active. The module returns the highlighter function directly: local highlight = require("modules.highlight.yaml") local segments = highlight("name: zero\n# comment\n")

token(role: string, fallback: string) → string

Internal: resolve `code.<role>` from the active theme; fall back to the deleted Rust constant when no `ui` global or no theme exists.

argtypedescription
rolestring
fallbackstring

push(segments: ?, text: ?, color: ?) → void

argtypedescription
segments?
text?
color?

trim(s: string) → string

argtypedescription
sstring

isAllNumericChars(s: string) → boolean

argtypedescription
sstring

highlightScalar(segments: ?, value: ?) → void

argtypedescription
segments?
value?

highlightContent(segments: ?, line: ?) → void

argtypedescription
segments?
line?

highlightYaml(text: string) →

Tokenize a YAML source string into colored text segments for the zui code renderer. Splits each line on a `#` comment first, then on the first `:` to extract a key from its value; the value is then classified as quoted string / bool / null / numeric / plain. defaults to `""` when nil. for the zui code renderer.

argtypedescription
textstringThe YAML source to highlight. Coerced via `tostring` and

examples

local segments = highlight("name: zero\n# comment\n")
⌬ Types
Segment = { text: string, color: string, monospace: boolean }

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

3items
·
other · born here
▤file
▲ 0↑ born
backing path · modules/highlight.module/yaml.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.