sigtop
sigtop copied to clipboard
Add an HTML export
Hello,
I am playing with the idea of an HTML export:
the goal would be to have a gui export. It would be easier to read by non tech folks. What do you think?
My draft of solution can be seen and tried on my fork: https://github.com/aloisdg/sigtop/pull/1
If @tbvdm likes it, we can plan to add it sigtop later on. It is not ready yet
Caveat: this is my first time writing Go without ever learning it.
Thanks for working on this! Very promising!
Please don't forget to escape HTML in the input; use html.EscapeString for that. (It would be even better to use the html/template package, but perhaps that's something for later.)
Also, I think HTML exports should be self-contained, so please avoid stylesheets from external sources.
You probably wanted to hack something together quickly, so I understand that you took a few shortcuts. :)
Yes this is indeed a quick a dirty version. I will remove watercss later on. I now next to nothing about Golang.
I would love to extract the html from the Go file and put in a proper html file. Feel free to help with that (with a package or file loading/import logic maybe?)
I would love to extract the html from the Go file and put in a proper html file.
You can use the embed package:
import (
_ "embed"
// ...
)
//go:embed header.html
var htmlHeader string
func f() {
fmt.Print(htmlHeader)
}
Thank you I will look into that next week
Great!
This would be awesome!!
It's been a while but, any updates on this ? Or help needed ? :)