firecrawl/apps/api/sharedLibs/go-html-to-md/html-to-markdown.go
2024-11-11 21:09:27 +01:00

26 lines
496 B
Go

package main
import (
"C"
// "log"
md "github.com/tomkosm/html-to-markdown"
"github.com/tomkosm/html-to-markdown/plugin"
)
//export ConvertHTMLToMarkdown
func ConvertHTMLToMarkdown(html *C.char) *C.char {
converter := md.NewConverter("", true, nil)
converter.Use(plugin.GitHubFlavored())
markdown, err := converter.ConvertString(C.GoString(html))
if err != nil {
// log.Fatal(err)
}
return C.CString(markdown)
}
func main() {
// This function is required for the main package
}