Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Goでマークダウンの独自記法を実装する

Avatar for lag129 lag129
August 25, 2025

 Goでマークダウンの独自記法を実装する

Avatar for lag129

lag129

August 25, 2025

Other Decks in Technology

Transcript

  1. 実際のコード1 func Render(ctx context.Context, src string) (string, error) { html

    := template.HTMLEscapeString(src) md := goldmark.New( goldmark.WithExtensions( Wikipedia, ), ) var buf bytes.Buffer if err := md.Convert([]byte(html), &buf); err != nil { return "", nil } return buf.String(), nil } 7
  2. 実際のコード2 // 中略 client := &http.Client{ CheckRedirect: func(req *http.Request, via

    []*http.Request) error { return http.ErrUseLastResponse }, } resp, _ := client.Head(url) return resp.StatusCode 9