// https://github.com/gogs/go-gogs-client/wiki/Miscellaneous#render-an-arbitrary-markdown-document
979912
func Markdown(c *context.APIContext, form api.MarkdownOption) {
	if c.HasApiError() {
		c.Error(422, "", c.GetErrMsg())
		return
	}

	if len(form.Text) == 0 {
		c.Write([]byte(""))
		return
	}

	switch form.Mode {
	case "gfm":
		c.Write(markup.Markdown([]byte(form.Text), form.Context, nil))
	default:
		c.Write(markup.RawMarkdown([]byte(form.Text), ""))
	}
}
841598
func (t *File_Template) RenderL(m LiteralMap) (string, error) {
	pm, err := m.Convert()
	if err != nil {
		return "", err
	}
	return t.Render(pm)
}
672608
func (g *Generator) Render(templ string) ([]byte, error) {
	if g.loader == nil {
		g.loader = &symbols.Loader{Source: g.Starlark}
		g.links = map[string]*symbol{}
	}

	t, err := template.New("main").Funcs(g.funcMap()).Parse(templ)
	if err != nil {
		return nil, err
	}

	buf := bytes.Buffer{}
	if err := t.Execute(&buf, nil); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
285007
func (renderer *HTMLTemplateRenderer) Render(template string, model Model) error {
	templates, err := renderer.provider.Provide()
	if err != nil {
		renderer.errorf(template, err)
		return err
	}
	setContentType(renderer.writer, ContentHTML)
	err = templates.ExecuteTemplate(renderer.writer, template, model)
	if err != nil {
		renderer.errorf(template, err)
		return err
	}
	return nil
}
627651
func (h HTML) Render(w io.Writer, binding interface{}) error {
	// Retrieve a buffer from the pool to write to.
	out := bufPool.Get()
	err := h.Templates.ExecuteTemplate(out, h.Name, binding)
	if err != nil {
		return err
	}

	if hw, ok := w.(http.ResponseWriter); ok {
		h.Head.Write(hw)
	}
	out.WriteTo(w)

	// Return the buffer to the pool.
	bufPool.Put(out)
	return nil
}
577081
func renderGodepFilesError(label string, commits []util.Commit, opt CommitFilesRenderOption) string {
	msg := fmt.Sprintf("%s:\n\n", label)
	for _, commit := range commits {
		msg += fmt.Sprintf("[%s] %s\n", commit.Sha, commit.Summary)
		if opt == RenderNoFiles {
			continue
		}
		for _, file := range commit.Files {
			if opt == RenderAllFiles ||
				(opt == RenderOnlyGodepsFiles && file.HasVendoredCodeChanges()) ||
				(opt == RenderOnlyNonGodepsFiles && !file.HasVendoredCodeChanges()) {
				msg += fmt.Sprintf("  - %s\n", file)
			}
		}
	}
	return msg
}
35067
func Render(typ Type, input interface{}, urlPrefix string, metas map[string]string) []byte {
	var rawBytes []byte
	switch v := input.(type) {
	case []byte:
		rawBytes = v
	case string:
		rawBytes = []byte(v)
	default:
		panic(fmt.Sprintf("unrecognized input content type: %T", input))
	}

	urlPrefix = strings.TrimRight(strings.Replace(urlPrefix, " ", "%20", -1), "/")
	var rawHTML []byte
	switch typ {
	case MARKDOWN:
		rawHTML = RawMarkdown(rawBytes, urlPrefix)
	case ORG_MODE:
		rawHTML = RawOrgMode(rawBytes, urlPrefix)
	default:
		return rawBytes // Do nothing if syntax type is not recognized
	}

	rawHTML = postProcessHTML(rawHTML, urlPrefix, metas)
	return SanitizeBytes(rawHTML)
}
682421
func (ctx *Context) Render(bytes []byte) {
	//debug
	//fmt.Println("response msg = ", string(bytes))
	ctx.Writer.WriteHeader(200)
	_, err := ctx.Writer.Write(bytes)
	if err != nil {
		panic(err)
	}
}
1034029
func (r YAML) Render(w http.ResponseWriter) error {
	r.WriteContentType(w)

	bytes, err := yaml.Marshal(r.Data)
	if err != nil {
		return err
	}

	_, err = w.Write(bytes)
	return err
}
612241
func (t *Template) Render(w io.Writer, context ...interface{}) error {
	return t.render(newWriter(w), context...)
}
589208
func Render(tplName string, w http.ResponseWriter, data interface{}) (err error) {
	w.Header().Set("Content-Type", "text/html")
	defer func() {
		if err != nil {
			w.Header().Del("Content-Type")
		}
	}()
	return Execute(tplName, w, data)
}
18455
func RenderStack(err error, excludePkgs ...string) []string {
	return renderStack(err).toLines(excludePkgs...)
}
514300
func (c *Context) HTML(code int, name string, obj interface{}) {
	instance := c.engine.HTMLRender.Instance(name, obj)
	c.Render(code, instance)
}
359497
func (r *RenderRenderer) Render(w http.ResponseWriter, code int, templateName string, data interface{}, layout string) {
	if layout != "" {
		r.r.HTML(w, code, templateName, data, render.HTMLOptions{Layout: layout})
		return
	}
	r.r.HTML(w, code, templateName, data)
}
182946
func RenderScript(cfg cloudinit.RenderConfig, ds ...Decorator) ([]byte, error) {
	out, err := cfg.RenderScript()
	if err != nil {
		return nil, err
	}
	return applyDecorators([]byte(out), ds), nil
}
669968
func (renderer *Renderer) Render(response *plugins.Response, files []string) (err error) {
	for _, filename := range files {
		file := &plugins.File{Name: filename}
		switch filename {
		case "client.go":
			file.Data, err = renderer.RenderClient()
		case "types.go":
			file.Data, err = renderer.RenderTypes()
		case "provider.go":
			file.Data, err = renderer.RenderProvider()
		case "server.go":
			file.Data, err = renderer.RenderServer()
		case "constants.go":
			file.Data, err = renderer.RenderConstants()
		default:
			file.Data = nil
		}
		if err != nil {
			response.Errors = append(response.Errors, fmt.Sprintf("ERROR %v", err))
		}
		// run generated Go files through imports pkg
		if filepath.Ext(file.Name) == ".go" {
			file.Data, err = imports.Process(file.Name, file.Data, nil)
		}
		response.Files = append(response.Files, file)
	}
	return
}
747249
func markdownHelper(body string) template.HTML {
	b := github_flavored_markdown.Markdown([]byte(body))
	return template.HTML(b)
}