diff --git a/github/examples_test.go b/github/examples_test.go index db82e4de0de..4aca86218fa 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -15,14 +15,14 @@ import ( "github.com/google/go-github/v55/github" ) -func ExampleMarkdownService_Markdown() { +func ExampleMarkdownService_Render() { client := github.NewClient(nil) input := "# heading #\n\nLink to issue #1" opt := &github.MarkdownOptions{Mode: "gfm", Context: "google/go-github"} ctx := context.Background() - output, _, err := client.Markdown.Markdown(ctx, input, opt) + output, _, err := client.Markdown.Render(ctx, input, opt) if err != nil { fmt.Println(err) } diff --git a/github/markdown.go b/github/markdown.go index 871b1a77624..48b445b3d85 100644 --- a/github/markdown.go +++ b/github/markdown.go @@ -13,10 +13,10 @@ import ( // MarkdownService provides access to markdown-related functions in the GitHub API. type MarkdownService service -// MarkdownOptions specifies optional parameters to the Markdown method. +// MarkdownOptions specifies optional parameters to the Render method. type MarkdownOptions struct { // Mode identifies the rendering mode. Possible values are: - // markdown - render a document as plain Markdown, just like + // markdown - render a document as plain Render, just like // README files are rendered. // // gfm - to render a document as user-content, e.g. like user @@ -32,17 +32,17 @@ type MarkdownOptions struct { Context string } -type markdownRequest struct { +type markdownRenderRequest struct { Text *string `json:"text,omitempty"` Mode *string `json:"mode,omitempty"` Context *string `json:"context,omitempty"` } -// Markdown renders an arbitrary Markdown document. +// Render renders an arbitrary Render document. // // GitHub API docs: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document -func (s *MarkdownService) Markdown(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { - request := &markdownRequest{Text: String(text)} +func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { + request := &markdownRenderRequest{Text: String(text)} if opts != nil { if opts.Mode != "" { request.Mode = String(opts.Mode) diff --git a/github/markdown_test.go b/github/markdown_test.go index 3bbf9fb7357..2b6e7eee48e 100644 --- a/github/markdown_test.go +++ b/github/markdown_test.go @@ -19,13 +19,13 @@ func TestMarkdownService_Markdown(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - input := &markdownRequest{ + input := &markdownRenderRequest{ Text: String("# text #"), Mode: String("gfm"), Context: String("google/go-github"), } mux.HandleFunc("/markdown", func(w http.ResponseWriter, r *http.Request) { - v := new(markdownRequest) + v := new(markdownRenderRequest) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") @@ -36,21 +36,21 @@ func TestMarkdownService_Markdown(t *testing.T) { }) ctx := context.Background() - md, _, err := client.Markdown.Markdown(ctx, "# text #", &MarkdownOptions{ + md, _, err := client.Markdown.Render(ctx, "# text #", &MarkdownOptions{ Mode: "gfm", Context: "google/go-github", }) if err != nil { - t.Errorf("Markdown returned error: %v", err) + t.Errorf("Render returned error: %v", err) } if want := "