HTML

Create a HTML-File (in the root or in a subdirectory) and past this code in the Go-File. With the LoadHTMLGlob-Function, you can get the folder with all HTML-Files.

r := gin.Default()
r.LoadHTMLGlob("sites/*")

r.GET("/", func(c *gin.Context) {
	c.HTML(200, "index.html", nil)
})

Example-directory:

Markdown

import (
	"github.com/gin-gonic/gin"
	"github.com/gomarkdown/markdown"
)

r.GET("/", func(c *gin.Context) {
		mdFile, err := ioutil.ReadFile("./markdown.md")
		if err != nil {
			fmt.Println("can not get file with name: " + "./markdown.md")
		}

		md := []byte(mdFile)
		output := markdown.ToHTML(md, nil, nil)
		c.Data(http.StatusOK, "text/html; charset=utf-8", output)
	})

HTML rendering