MCPcopy Index your code
hub / github.com/google/go-github / Render

Method Render

github/markdown.go:46–69  ·  view source on GitHub ↗

Render renders an arbitrary Render document. GitHub API docs: https://docs.github.com/rest/markdown/markdown?apiVersion=2022-11-28#render-a-markdown-document meta:operation POST /markdown

(ctx context.Context, text string, opts *MarkdownOptions)

Source from the content-addressed store, hash-verified

44//
45//meta:operation POST /markdown
46func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) {
47 request := &markdownRenderRequest{Text: &text}
48 if opts != nil {
49 if opts.Mode != "" {
50 request.Mode = &opts.Mode
51 }
52 if opts.Context != "" {
53 request.Context = &opts.Context
54 }
55 }
56
57 req, err := s.client.NewRequest(ctx, "POST", "markdown", request)
58 if err != nil {
59 return "", nil, err
60 }
61
62 var buf bytes.Buffer
63 resp, err := s.client.Do(req, &buf)
64 if err != nil {
65 return "", resp, err
66 }
67
68 return buf.String(), resp, nil
69}

Callers 2

Calls 3

NewRequestMethod · 0.80
DoMethod · 0.45
StringMethod · 0.45

Tested by 2