mirror of
https://github.com/avelino/awesome-go.git
synced 2024-11-07 16:33:40 +00:00
30 lines
529 B
Go
30 lines
529 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"fmt"
|
||
|
"io/ioutil"
|
||
|
|
||
|
"github.com/PuerkitoBio/goquery"
|
||
|
"github.com/russross/blackfriday"
|
||
|
)
|
||
|
|
||
|
func readme() []byte {
|
||
|
input, err := ioutil.ReadFile("./README.md")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
html := fmt.Sprintf("<body>%s</body>", blackfriday.MarkdownCommon(input))
|
||
|
htmlByteArray := []byte(html)
|
||
|
return htmlByteArray
|
||
|
}
|
||
|
|
||
|
func startQuery() *goquery.Document {
|
||
|
buf := bytes.NewBuffer(readme())
|
||
|
query, err := goquery.NewDocumentFromReader(buf)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
return query
|
||
|
}
|