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)
| 44 | // |
| 45 | //meta:operation POST /markdown |
| 46 | func (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 | } |