sigtop icon indicating copy to clipboard operation
sigtop copied to clipboard

Add an HTML export

Open aloisdg opened this issue 1 year ago • 7 comments

Hello,

I am playing with the idea of an HTML export:

image

the goal would be to have a gui export. It would be easier to read by non tech folks. What do you think?

aloisdg avatar Oct 19 '24 15:10 aloisdg

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.

aloisdg avatar Oct 19 '24 23:10 aloisdg

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. :)

tbvdm avatar Oct 21 '24 18:10 tbvdm

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?)

aloisdg avatar Oct 21 '24 20:10 aloisdg

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)
}

tbvdm avatar Oct 25 '24 17:10 tbvdm

Thank you I will look into that next week

aloisdg avatar Nov 02 '24 12:11 aloisdg

Great!

tbvdm avatar Nov 06 '24 19:11 tbvdm

This would be awesome!!

ghost avatar Nov 22 '24 13:11 ghost

It's been a while but, any updates on this ? Or help needed ? :)

idealemu avatar Apr 26 '25 14:04 idealemu