• Stars
    star
    4
  • Rank 3,303,987 (Top 66 %)
  • Language
    Go
  • License
    MIT License
  • Created over 1 year ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿน render YAML as HTML in Go

๐Ÿน htmlyaml: rich rendering of YAML as HTML in Go

codecov Go Report Card Go Reference Mentioned in Awesome Go OpenSSF Scorecard

  • 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

More Repositories

1

go-recipes

๐Ÿฆฉ Tools for Go projects
Go
4,036
star
2

go-cover-treemap

๐ŸŽ„ Go code coverage to SVG treemap
Go
484
star
3

go-binsize-treemap

๐Ÿ” Go binary size SVG treemap
Go
444
star
4

calendarheatmap

๐Ÿ“… Calendar heatmap inspired by GitHub contribution activity
Go
393
star
5

llama2.go

LLaMA-2 in native Go
Go
187
star
6

go-instrument

โšก๏ธ Automatically add Trace Spans to Go methods and functions
Go
163
star
7

treemap

๐Ÿฌ Pretty Treemaps
Go
149
star
8

go-featureprocessing

๐Ÿ”ฅ Fast, simple sklearn-like feature processing for Go
Go
116
star
9

go-hackers-delight

"Hacker's Delight" in Go
Go
85
star
10

go-graph-layout

๐Ÿ”ฎ Graph Layout Algorithms in Go
Go
85
star
11

go-cover-treemap-web

Go
78
star
12

jsonl-graph

๐Ÿ JSONL Graph Tools
Go
72
star
13

import-graph

Collect data about your dependencies
Go
40
star
14

twitter-remover

Remove twitter likes, posts, retweets, replies, followers
38
star
15

watchhttp

๐ŸŒบ Run command periodically and expose latest STDOUT as HTTP endpoint
Go
32
star
16

go-ml-benchmarks

โฑ Benchmarks of machine learning inference for Go
Go
30
star
17

fpdecimal

๐Ÿ›ซ Fixed-Point Decimals
Go
29
star
18

fpmoney

๐Ÿงง Fixed-Point Decimal Money
Go
25
star
19

validate

๐Ÿฅฌ validate. simply.
Go
19
star
20

hq

๐Ÿ happy little queue
Go
16
star
21

smrcptr

detect mixing pointer and value method receivers
Go
13
star
22

neuroscience-landscape

๐ŸŒŒ Resources on Neuroscience
12
star
23

vertfn

Go linter for Vertical Function Ordering
Go
12
star
24

go-enum-encoding

Generate Go enum encoding
Go
12
star
25

go-enum-example

Go Enum: benchmarks, examples, analysis
Go
8
star
26

htmljson

๐Ÿซ Rich rendering of JSON as HTML in Go
Go
7
star
27

multiline-jsonl

Read and write multiline JSONL in Go
Go
6
star
28

openapi-inline-examples

๐ŸŒ Inline OpenAPI JSON examples from filenames
Go
6
star
29

go-commentage

How far Go comments drifting behind?
Go
4
star
30

rchan

Go channel through Redis List
Go
4
star
31

mini-awesome-cv

๐Ÿ“ LaTeX Awesome-CV under 200LOC
TeX
4
star
32

go-instrument-example

Go
3
star
33

svgpan

Pan and Zoom of SVG in your Go front-end app in browser.
Go
3
star
34

go-bench-errors

Benchmarking Go errors
Go
3
star
35

mdpage

one-pager Markdown list from YAML
Go
3
star
36

consistentimports

Detect inconsistent import aliases
Go
2
star
37

go-callsite-stats

analyse function callsites
Go
2
star
38

read-seek-peeker

Go Reader that can Seek() and Peek()
Go
2
star
39

go-bench-stream

๐ŸŒŠ Go Benchmarks for Stream Processing
Go
2
star
40

go-bitset-example

Go Bitset: benchmarks, examples, analysis
Go
1
star
41

aws-s3-reader

Efficient Go Reader for large AWS S3 Objects
Go
1
star
42

go-bench-receiver

Which is more efficient value or pointer method receivers in Go?
Go
1
star
43

totp

TOTP (RFC-6238) and HOTP (RFC-4226)
Go
1
star
44

dotfiles

macOS, Linux
Vim Script
1
star
45

presentations

1
star
46

PINTOS

C
1
star
47

ARIA

C++
1
star
48

mini-blog

JavaScript
1
star
49

graph-tools-gallery

Inspiration gallery of graph tools
1
star