🐹 htmlyaml: rich rendering of YAML as HTML in Go pure Go no Javascript no dependencies no reflect no fmt no text/template, html/template 300 LOC customizable rendering JSON Path for elements access // YAML has to be any var v any yaml.Unmarshal(exampleYAML, &v) htmlPage := htmlyaml.DefaultPageMarshaler.Marshal(v) // YAML has to be any var v any yaml.Unmarshal(exampleYAML, &v) // customize how to render HTML elements s := htmlyaml.DefaultMarshaler s.Number = func(k string, v float64, s string) string { if k == "$.cakes.strawberry-cake.size" { return `<div class="yaml-value yaml-number" style="color:red;">` + s + `</div>` } if v > 10 { return `<div class="yaml-value yaml-number" style="color:blue;">` + s + `</div>` } return `<div class="yaml-value yaml-number">` + s + `</div>` } m := htmlyaml.DefaultPageMarshaler m.Marshaler = &s // write HTML page htmlPage := m.Marshal(v) Related Work https://github.com/alecthomas/chroma can render many languages into HTML with syntax highligting