{"id":13413952,"url":"https://github.com/nikolaydubina/htmlyaml","last_synced_at":"2025-03-17T19:31:23.376Z","repository":{"id":146432786,"uuid":"615731491","full_name":"nikolaydubina/htmlyaml","owner":"nikolaydubina","description":"🐹 render YAML as HTML in Go","archived":false,"fork":false,"pushed_at":"2024-03-21T11:36:14.000Z","size":1074,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T14:34:55.644Z","etag":null,"topics":["code-editor","code-visualisation","data-visualisation","go","golang","rendering","text-formatting","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikolaydubina.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"nikolaydubina"}},"created_at":"2023-03-18T14:16:35.000Z","updated_at":"2024-05-09T05:37:45.313Z","dependencies_parsed_at":"2024-01-07T21:54:08.349Z","dependency_job_id":"df24207d-60be-44cc-914d-64144965b3b7","html_url":"https://github.com/nikolaydubina/htmlyaml","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fhtmlyaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fhtmlyaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fhtmlyaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fhtmlyaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikolaydubina","download_url":"https://codeload.github.com/nikolaydubina/htmlyaml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878439,"owners_count":20362432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-editor","code-visualisation","data-visualisation","go","golang","rendering","text-formatting","yaml"],"created_at":"2024-07-30T20:01:53.531Z","updated_at":"2025-03-17T19:31:22.836Z","avatar_url":"https://github.com/nikolaydubina.png","language":"Go","funding_links":["https://github.com/sponsors/nikolaydubina"],"categories":["Go","Text Processing","文本处理","Template Engines"],"sub_categories":["Markup Languages","标记语言"],"readme":"## 🐹 htmlyaml: rich rendering of YAML as HTML in Go\n\n[![codecov](https://codecov.io/gh/nikolaydubina/htmlyaml/branch/master/graph/badge.svg?token=yXmNdIDn8O)](https://codecov.io/gh/nikolaydubina/htmlyaml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nikolaydubina/htmlyaml)](https://goreportcard.com/report/github.com/nikolaydubina/htmlyaml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/nikolaydubina/htmlyaml.svg)](https://pkg.go.dev/github.com/nikolaydubina/htmlyaml)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/nikolaydubina/htmlyaml/badge)](https://securityscorecards.dev/viewer/?uri=github.com/nikolaydubina/htmlyaml)\n\n* pure Go\n* no Javascript\n* no dependencies\n* no `reflect`\n* no `fmt`\n* no `text/template`, `html/template`\n* 300 LOC\n* customizable rendering\n* JSON Path for elements access\n\n![](./doc/example-color.png)\n\n```go\n// YAML has to be any\nvar v any\nyaml.Unmarshal(exampleYAML, \u0026v)\n\nhtmlPage := htmlyaml.DefaultPageMarshaler.Marshal(v)\n```\n\n```go\n// YAML has to be any\nvar v any\nyaml.Unmarshal(exampleYAML, \u0026v)\n\n// customize how to render HTML elements\ns := htmlyaml.DefaultMarshaler\ns.Number = func(k string, v float64, s string) string {\n    if k == \"$.cakes.strawberry-cake.size\" {\n        return `\u003cdiv class=\"yaml-value yaml-number\" style=\"color:red;\"\u003e` + s + `\u003c/div\u003e`\n    }\n    if v \u003e 10 {\n        return `\u003cdiv class=\"yaml-value yaml-number\" style=\"color:blue;\"\u003e` + s + `\u003c/div\u003e`\n    }\n    return `\u003cdiv class=\"yaml-value yaml-number\"\u003e` + s + `\u003c/div\u003e`\n}\n\nm := htmlyaml.DefaultPageMarshaler\nm.Marshaler = \u0026s\n\n// write HTML page\nhtmlPage := m.Marshal(v)\n```\n\n## Related Work\n\n- https://github.com/alecthomas/chroma can render many languages into HTML with syntax highligting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolaydubina%2Fhtmlyaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikolaydubina%2Fhtmlyaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolaydubina%2Fhtmlyaml/lists"}