github_flavored_markdown icon indicating copy to clipboard operation
github_flavored_markdown copied to clipboard

Web Preview Got Exceptions for HTML Syntax

Open AnqianW opened this issue 4 years ago • 0 comments

For https://pkg.go.dev/github.com/shurcooL/github_flavored_markdown#example-Markdown-CompleteHTMLPage

I tried with http handler:

	http.Handle("/assets/", http.StripPrefix("/assets", http.FileServer(gfmstyle.Assets)))
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		io.WriteString(w, `<html><head><meta charset="utf-8"><link href="/assets/gfm.css" media="all" rel="stylesheet" type="text/css" /><link href="//cdnjs.cloudflare.com/ajax/libs/octicons/2.1.2/octicons.css" media="all" rel="stylesheet" type="text/css" /></head><body><article class="markdown-body entry-content" style="padding: 30px;">`)
		markdown := []byte("# GitHub Flavored Markdown\n\nHello.")
		w.Write(github_flavored_markdown.Markdown(markdown))
		io.WriteString(w, `</article></body></html>`)
	})
	http.ListenAndServe(":8000", nil)

But I only got blank page on Chrome with the following syntax errors in console: 截屏2021-10-01 14 41 44 截屏2021-10-01 14 41 59

AnqianW avatar Oct 02 '21 15:10 AnqianW