Exemple #1
0
func doPOSTRender(c *gin.Context) {
	var json dtoMarkdownRender
	if c.BindJSON(&json) == nil {
		html := string(render.Render(json.Markdown))
		c.JSON(http.StatusOK, gin.H{"html": html})
	}
}
Exemple #2
0
import (
	"html/template"
	"io/ioutil"
	"net/http"

	"github.com/GeertJohan/go.rice"
	"github.com/adriamb/runes/server/instance"
	"github.com/adriamb/runes/store"
	"github.com/adriamb/runes/web/render"
	"github.com/gin-gonic/gin"
)

var markdownRender = template.FuncMap{
	"markdown": func(s string) template.HTML {
		proc := string(render.Render(s))
		return template.HTML(proc)
	},
	"raw": func(s string) template.HTML {
		return template.HTML(s)
	},
}

func generateTemplate() *template.Template {
	templateList := []string{
		"500.tmpl", "builtin.tmpl", "entry.tmpl", "logingoauth2.tmpl",
		"search.tmpl", "entries.tmpl", "files.tmpl",
		"headbegin.tmpl", "headend.tmpl", "tail.tmpl", "workspaces.tmpl",
		"workspacemenu.tmpl",
	}